Skip to content

AsyncHelper-4.0.0

Latest
Compare
Choose a tag to compare
@loganathan001 loganathan001 released this 15 Jun 16:36
· 2 commits to master since this release
ab50d67

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) or AsyncTask.of(ExecutorService, AsyncContext)
    AsyncSupplier ==> AsyncSupplier.of(ExecutorService) or AsyncSupplier.of(ExecutorService, AsyncContext)
    SchedulingTask ==> SchedulingTask.of(ScheduledExecutorService) or SchedulingTask.of(ScheduledExecutorService, AsyncContext)
    SchedulingSupplier ==> SchedulingSupplier.of(ScheduledExecutorService) or SchedulingSupplier.of(ScheduledExecutorService, AsyncContext)

  • The default instances of AsyncTask and AsyncSupplier use a common ForkJoinPool. But it is possible to get customized instances of these can be obtained by passing a new ExecutorService instance.

  • The default instances of SchedulingTask and SchedulingSupplier use a common ScheduledExecutorService. But it is possible to get customized instances of these can be obtained by passing a new ScheduledExecutorService 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>