Java collection with quiet period
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
pom.xml

README.md

Asparagus

Build Status codecov Maven Central License Stories in Ready

Time-aware set implementations. Can be used to implement throttles with quiet period.

Use case

Say you have a queue, producer, and consumer. The producer is quick but with uneven pace. Messages it produces can repeat, and do come in groups. The consumer though is interested only in unique messages. Also if there are two or more repeated messages in quick succession, the consumer should only act once.

In other words: the consumer wants elements that are now in their quiet period.

Dependencies

Only SLF4J but used very sparingly.

Maven

<dependency>
  <groupId>pl.essekkat</groupId>
  <artifactId>asparagus</artifactId>
  <version>1.2.1</version>
</dependency>

Usage

Asparagus<String> a = new ManagedTimedAsparagus<>(50);
a.add("a");
a.add("b");
Thread.sleep(51);
a.size() == 2;

Callbacks

ManagedTimedAsparagus can call function(s) after successful promotions. Look into pl.essekkat.asparagus.thread.ThreadedTest.callback.

Issues

Please use GitHub Issues.

Future plans

  • Overflow controls
  • Persistent store for queues
  • Inter-JVM synchronization (JGroups?)
  • More tests