delight-concurrency
Abstract concurrency API for Java applications based on vanilla Java.
This library is particularly useful when threads and thread-safe objects are used in code which is shared between GWT and JRE environments.
Part of Java Delight.
Usage
Initialize concurrency instance.
Concurrency concurrency = ConcurrencyJre.create();
Create an atomic Integer:
SimpleAtomicInteger = concurrency.newAtomicInteger(0);
Create a collection:
List<String> list = concurreny.newCollection().newThreadSafeList(String);
Create an executor:
SimpleExecutor executor = concurrency.newExecutor().newParallelExecutor(5, this);
executor.execute(new Runnable() {
...
});
executor.shutdown(new SimpleCallback() {
@Override
public void onFailure(Throwable t) {
throw new RuntimeException(t);
}
@Override
public void onSuccess() {
// all done
}
});
Maven Dependency
<dependency>
<groupId>org.javadelight</groupId>
<artifactId>delight-concurrency</artifactId>
<version>[latest version]</version>
</dependency>
This artifact is available on Maven Central and BinTray.