Skip to content

Commit a44c0ac

Browse files
committed
Make javadoc for Keybuffer more concise.
1 parent 76b1ab5 commit a44c0ac

File tree

1 file changed

+5
-27
lines changed
  • powertools-logging/src/main/java/software/amazon/lambda/powertools/logging/internal

1 file changed

+5
-27
lines changed

powertools-logging/src/main/java/software/amazon/lambda/powertools/logging/internal/KeyBuffer.java

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,13 @@
2121
import java.util.function.Function;
2222

2323
/**
24-
* Generic buffer data structure for storing events by key with size-based eviction.
24+
* Thread-safe buffer that stores events by key with size-based eviction.
2525
*
26-
* <p>This buffer maintains separate event queues for each key, with configurable size limits
27-
* to prevent memory exhaustion. When buffers exceed their size limit, older events are
28-
* automatically evicted to make room for newer ones.
26+
* <p>Maintains separate queues per key. When buffer size exceeds maxBytes,
27+
* oldest events are evicted FIFO. Events larger than maxBytes are rejected.
2928
*
30-
* <h3>Key Features:</h3>
31-
* <ul>
32-
* <li><strong>Per-key buffering:</strong> Each key maintains its own independent buffer</li>
33-
* <li><strong>Size-based eviction:</strong> Oldest events are removed when buffer size exceeds limit</li>
34-
* <li><strong>Overflow protection:</strong> Events larger than buffer size are rejected entirely</li>
35-
* <li><strong>Thread-safe:</strong> Supports concurrent access across different keys</li>
36-
* <li><strong>Overflow tracking:</strong> Logs warnings when events are evicted or rejected</li>
37-
* </ul>
38-
*
39-
* <h3>Eviction Behavior:</h3>
40-
* <ul>
41-
* <li><strong>Buffer overflow:</strong> When adding an event would exceed maxBytes, oldest events are evicted first</li>
42-
* <li><strong>Large events:</strong> Events larger than maxBytes are rejected without evicting existing events</li>
43-
* <li><strong>FIFO eviction:</strong> Events are removed in first-in-first-out order during overflow</li>
44-
* <li><strong>Overflow warnings:</strong> Automatic logging when events are evicted or rejected</li>
45-
* </ul>
46-
*
47-
* <h3>Thread Safety:</h3>
48-
* <p>This class is thread-safe for concurrent operations. Different keys can be accessed
49-
* simultaneously, and operations on the same key are synchronized to prevent data corruption.
50-
*
51-
* @param <K> the type of key used for buffering (e.g., String for trace IDs)
52-
* @param <T> the type of events to buffer (must be compatible with the size calculator)
29+
* @param <K> key type for buffering
30+
* @param <T> event type to buffer
5331
*/
5432
public class KeyBuffer<K, T> {
5533

0 commit comments

Comments
 (0)