Reputation: 527
I am migrating my application from websphere traditional to liberty.
The code makes use of asynchronous scheduling processes.
How do I migrate this code to websphere liberty.
When trying to configure this in liberty (server.xml) I found 3 elements
a) Managed Scheduled Executor
b) Persistent Scheduled Executor
c) Managed Executor
Which of this can be used?
Upvotes: 1
Views: 481
Reputation: 42936
Options (A) and (C) can be used by enabling the concurrent-1.0
feature in server.xml.
Usually these do not need to be explicitly configured in server.xml, and can be directly used in your application like so:
import javax.enterprise.concurrent.*;
// ...
@Resource
ManagedScheduledExecutorService scheduledExec;
@Resource
ManagedExecutorService exec;
The "scheduled" executor service extends the non-scheduled variant, and adds some methods for invoking tasks on some sort of schedule, such as a fixed rate or a fixed delay.
The javadoc for ManagedExecutorService
can be found here: https://openliberty.io/docs/ref/javaee/8/#package=javax/enterprise/concurrent/package-frame.html&class=javax/enterprise/concurrent/ManagedScheduledExecutorService.html
For option (B), this is an SPI component that allows EJB timers to be persisted. Applications do not use it directly, but whenever an EJB uses @Schedule(persistent=true, ...)
then the persistent timer service will be used.
Upvotes: 0