What's New
-
Async-Helper is an OSGi bundle now :), to use it directly in OSGi applications.
-
Renamed Async helper class to AsyncContext so that there is option to limit the context of Asynchronous operations. The global context can be obtained using
AscynContext.getDefault()
. -
All the existing helper classes and their methods are now converted from static to instances, so that,
Either their default instances can be obtained using their getDefault() methods,
AsyncContext ==>
AsyncContext.getDefault()
AsyncTask ==>AsyncTask.getDefault()
AsyncSupplier ==>AsyncSupplier.getDefault()
SchedulingTask ==>SchedulingTask.getDefault()
SchedulingSupplier ==>SchedulingSupplier.getDefault()
Or they can be instantiated with a specific arguments.
AsyncContext ==>
AsyncContext.newInstance()
AsyncTask ==>AsyncTask.of(ExecutorService)
orAsyncTask.of(ExecutorService, AsyncContext)
AsyncSupplier ==>AsyncSupplier.of(ExecutorService)
orAsyncSupplier.of(ExecutorService, AsyncContext)
SchedulingTask ==>SchedulingTask.of(ScheduledExecutorService)
orSchedulingTask.of(ScheduledExecutorService, AsyncContext)
SchedulingSupplier ==>SchedulingSupplier.of(ScheduledExecutorService)
orSchedulingSupplier.of(ScheduledExecutorService, AsyncContext)
-
The default instances of
AsyncTask
andAsyncSupplier
use a commonForkJoinPool
. But it is possible to get customized instances of these can be obtained by passing a newExecutorService
instance. -
The default instances of
SchedulingTask
andSchedulingSupplier
use a commonScheduledExecutorService
. But it is possible to get customized instances of these can be obtained by passing a newScheduledExecutorService
instance. -
AsyncTask includes a new static helper method
AsyncTask.submitTaskInNewThread(Runnable)
to submit a task by spawning a new thread.
To install use below maven dependency entry:
<dependency>
<groupId>org.vishag</groupId>
<artifactId>async-helper</artifactId>
<version>4.0.0</version>
</dependency>