https://github.com/hadielmougy/jblockingbuffer
https://github.com/hadielmougy/jblockingbuffer
blockingqueue buffer concurrent-queue
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hadielmougy/jblockingbuffer
- Owner: hadielmougy
- License: apache-2.0
- Created: 2021-01-01T21:19:34.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-07-28T14:14:22.000Z (over 2 years ago)
- Last Synced: 2025-01-05T00:44:51.041Z (about 1 year ago)
- Topics: blockingqueue, buffer, concurrent-queue
- Language: Java
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JBlockingBuffer
Concurrent blocking buffer
```xml
io.github
jblockingbuffer
1.0
```
## Buffer by time
```java
// buffer size -1 means unlimited size
BlockingBuffer buffer = new BlockingBuffer<>(-1, Duration.ofMillis(500));
buffer.add(1);
var list = buffer.get();
```
## Buffer by size and time (whatever happens first)
```java
BlockingBuffer buffer = new BlockingBuffer<>(10, Duration.ofMillis(500));
buffer.add(1);
// will release after 500 millis
var list = buffer.get();
```
### defaults
- size is 10
- time is 100 millis