Skip to content

Commit 4eb768c

Browse files
committed
chore: update javadocs
Signed-off-by: Marcos Tischer Vallim <tischer@gmail.com>
1 parent 1ebe942 commit 4eb768c

15 files changed

Lines changed: 132 additions & 40 deletions

.opencode/skills/java-docs/SKILL.md

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,6 @@ public class MyClass {
4343
- `@see` - Related documentation
4444
- `@deprecated` - Deprecation notice
4545

46-
### 🎯 **Performance Indicators**
47-
48-
#### **Mastery Levels**
49-
- **Beginner**: Basic Javadoc comments for public methods
50-
- **Intermediate**: Complete class and method documentation with all required tags
51-
- **Advanced**: Professional documentation with cross-references and examples
52-
53-
#### **Quality Metrics**
54-
- 100% of public classes documented
55-
- 100% of public methods documented
56-
- Proper use of all required Javadoc tags
57-
- Consistent documentation style
58-
- No missing or incomplete documentation
59-
6046
### 🛠️ **Implementation Process**
6147

6248
#### **Step 1: Class Documentation**
@@ -129,12 +115,6 @@ public User createUser(String username, String email)
129115
4. **Accuracy**: Keep documentation updated with code changes
130116
5. **Readability**: Use proper formatting and structure
131117

132-
#### **Tools Integration**
133-
- IDE auto-completion support
134-
- Documentation generation tools
135-
- Continuous integration integration
136-
- Version control integration
137-
138118
### 📚 **Resources**
139119

140120
#### **Reference Materials**
@@ -143,12 +123,6 @@ public User createUser(String username, String email)
143123
- Code style guidelines
144124
- Project documentation standards
145125

146-
#### **Training Resources**
147-
- Javadoc tutorial examples
148-
- Documentation style guides
149-
- Code review checklists
150-
- Best practice workshops
151-
152126
### 🎯 **Expected Outcomes**
153127
- Professional quality code documentation
154128
- Maintainable and readable documentation
@@ -164,10 +138,3 @@ public User createUser(String username, String email)
164138
- Code clarity and quality
165139
- Tool integration effectiveness
166140
- Consistency across codebase
167-
168-
### **Success Metrics**
169-
- 95%+ documentation coverage
170-
- Zero missing required tags
171-
- Positive code review feedback
172-
- Successful tool integration
173-
- Team adoption rate

amazon-sns-java-messaging-lib-template/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ com.amazon.sns.messaging.lib
5959

6060
| Class | Description |
6161
|----------------------------------|---------------------------------------------------------|
62+
| `PoisonRequestEntryException` | Base exception for request entries that must be dropped. |
6263
| `MaximumAllowedMessageException` | Thrown when a single serialized message exceeds 256 KB. |
64+
| `JsonProcessingException` | Thrown when a request payload fails to serialize to JSON. |
6365

6466
## Dependencies
6567

amazon-sns-java-messaging-lib-template/src/main/java/com/amazon/sns/messaging/lib/concurrent/RingBufferBlockingQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private void signalProducer() {
158158
* Since the buffer capacity is always a power of two, wrapping is performed
159159
* efficiently using a bit mask instead of the modulo operator.
160160
*
161-
* @param index the logical index to map
161+
* @param sequence the logical index to map
162162
* @return the corresponding slot index in the backing array
163163
*/
164164
private int index(final int sequence) {

amazon-sns-java-messaging-lib-template/src/main/java/com/amazon/sns/messaging/lib/core/AbstractAmazonSnsConsumer.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ private void publishBatch(final R publishBatchRequest) {
172172
}
173173
}
174174

175+
/**
176+
* Fails the pending future of a poison request entry and removes it from the pending map.
177+
*
178+
* @param failRequestEntryException the exception describing why the entry is poison
179+
* @param requestEntry the request entry being dropped
180+
*/
175181
private void failPoisonRequestEntry(final PoisonRequestEntryException failRequestEntryException, final RequestEntry<E> requestEntry) {
176182
LOGGER.error("Failed to process request {}: {}", requestEntry.getId(), failRequestEntryException.getMessage(), failRequestEntryException);
177183

@@ -287,7 +293,7 @@ private boolean canAddPayload(final int batchSizeBytes) {
287293
*
288294
* @param requests the request queue
289295
* @return an optional containing the assembled batch request, or empty
290-
* @throws InterruptedException
296+
* @throws InterruptedException if interrupted while waiting for queue elements
291297
*/
292298
private Optional<R> createBatch(final BlockingQueue<RequestEntry<E>> requests) throws InterruptedException {
293299
final AtomicInteger batchSizeBytes = new AtomicInteger(0);

amazon-sns-java-messaging-lib-template/src/main/java/com/amazon/sns/messaging/lib/core/AbstractAmazonSnsProducer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ public ListenableFuture<ResponseSuccessEntry, ResponseFailEntry> send(final Requ
8989
/**
9090
* Transitions the producer to the shutdown state. No further messages will be
9191
* accepted once shutdown.
92+
*
93+
* @param runnable the action to run after the producer enters the shutdown state
9294
*/
9395
@Override
9496
public void shutdown(final Runnable runnable) {

amazon-sns-java-messaging-lib-template/src/main/java/com/amazon/sns/messaging/lib/core/AbstractAmazonSnsTemplate.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public CompletableFuture<Void> await(final Duration timeout) {
104104
* For FIFO topics, a single-threaded pool is used to guarantee order.
105105
*
106106
* @param topicProperty the topic configuration
107+
* @param meterRegistry the Micrometer meter registry for executor metrics
107108
* @return a configured thread pool executor
108109
*/
109110
protected static ExecutorService getExecutorService(final TopicProperty topicProperty, final MeterRegistry meterRegistry) {
@@ -114,6 +115,19 @@ protected static ExecutorService getExecutorService(final TopicProperty topicPro
114115
);
115116
}
116117

118+
/**
119+
* Fluent builder for constructing SDK-specific {@link AbstractAmazonSnsTemplate}
120+
* implementations. Provides defaults for pending requests
121+
* ({@link ConcurrentHashMap}), topic requests ({@link RingBufferBlockingQueue}),
122+
* ObjectMapper, publish decorator (identity), and meter registry
123+
* ({@link SimpleMeterRegistry}).
124+
*
125+
* @param <C> the Amazon SNS client type
126+
* @param <R> the publish batch request type
127+
* @param <O> the publish batch result type
128+
* @param <E> the request entry payload type
129+
* @param <T> the concrete template type
130+
*/
117131
@Getter(value = AccessLevel.PACKAGE)
118132
public static final class Builder<C, R, O, E, T extends AbstractAmazonSnsTemplate<R, O, E>> {
119133

amazon-sns-java-messaging-lib-template/src/main/java/com/amazon/sns/messaging/lib/core/AmazonSnsProducer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public interface AmazonSnsProducer<E> {
4141

4242
/**
4343
* Shuts down the producer, preventing any further messages from being accepted.
44+
*
45+
* @param runnable the action to run after the producer enters the shutdown state
4446
*/
4547
public void shutdown(final Runnable runnable);
4648

amazon-sns-java-messaging-lib-template/src/main/java/com/amazon/sns/messaging/lib/core/ListenableFuture.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ default void addCallback(final Consumer<? super S> successCallback) {
7373
* Mirrors the contract of {@link java.util.concurrent.Future#get()}: if the future
7474
* completed with a failure, this throws {@link ExecutionException} instead of returning.
7575
* The exception's cause is the {@link Throwable} carried by the failure result, if any
76-
* (see {@link ResponseFailEntry#getThrowable()}), or a new exception built from the
76+
* (see {@code ResponseFailEntry#getThrowable()}), or a new exception built from the
7777
* failure result's message otherwise.
7878
*
7979
* @return the success result

amazon-sns-java-messaging-lib-template/src/main/java/com/amazon/sns/messaging/lib/core/ListenableFutureImpl.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ class ListenableFutureImpl implements ListenableFuture<ResponseSuccessEntry, Res
7373
this.callbackExecutor = Objects.requireNonNull(callbackExecutor, "callbackExecutor cannot be null");
7474
}
7575

76+
/**
77+
* {@inheritDoc}
78+
*/
7679
@Override
7780
public void addCallback(final Consumer<? super ResponseSuccessEntry> successCallback, final Consumer<? super ResponseFailEntry> failureCallback) {
7881
final Consumer<? super ResponseSuccessEntry> success = Optional.ofNullable(successCallback).orElse(identity()::apply);
@@ -87,20 +90,29 @@ public void addCallback(final Consumer<? super ResponseSuccessEntry> successCall
8790
}, callbackExecutor);
8891
}
8992

93+
/**
94+
* {@inheritDoc}
95+
*/
9096
@Override
9197
public void success(final ResponseSuccessEntry entry) {
9298
if (not(delegate::complete).test(entry)) {
9399
throw new IllegalStateException("ListenableFuture already completed.");
94100
}
95101
}
96102

103+
/**
104+
* {@inheritDoc}
105+
*/
97106
@Override
98107
public void fail(final ResponseFailEntry entry) {
99108
if (not(delegate::completeExceptionally).test(new FailureSignal(entry))) {
100109
throw new IllegalStateException("ListenableFuture already completed.");
101110
}
102111
}
103112

113+
/**
114+
* {@inheritDoc}
115+
*/
104116
@Override
105117
public ResponseSuccessEntry get() throws InterruptedException, ExecutionException {
106118
try {
@@ -110,6 +122,9 @@ public ResponseSuccessEntry get() throws InterruptedException, ExecutionExceptio
110122
}
111123
}
112124

125+
/**
126+
* {@inheritDoc}
127+
*/
113128
@Override
114129
public ResponseSuccessEntry get(final Duration timeout) throws InterruptedException, ExecutionException, TimeoutException {
115130
Objects.requireNonNull(timeout, "timeout cannot be null");

amazon-sns-java-messaging-lib-template/src/main/java/com/amazon/sns/messaging/lib/core/RequestEntryInternalFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public RequestEntryInternal create(final RequestEntry<?> requestEntry, final byt
6767
*
6868
* @param requestEntry the source request entry
6969
* @return a new internal request entry with serialized payload
70-
* @throws PoisonRequestEntryException
70+
* @throws PoisonRequestEntryException if the payload cannot be serialized
7171
*/
7272
public RequestEntryInternal create(final RequestEntry<?> requestEntry) throws PoisonRequestEntryException {
7373
return create(requestEntry, convertPayload(requestEntry));
@@ -79,7 +79,7 @@ public RequestEntryInternal create(final RequestEntry<?> requestEntry) throws Po
7979
*
8080
* @param requestEntry the request entry whose payload to convert
8181
* @return the serialized payload bytes
82-
* @throws PoisonRequestEntryException
82+
* @throws PoisonRequestEntryException if the payload fails JSON serialization
8383
*/
8484
public byte[] convertPayload(final RequestEntry<?> requestEntry) throws PoisonRequestEntryException {
8585
try {

0 commit comments

Comments
 (0)