Interface ScheduledExecutorServiceProvider
- All Superinterfaces:
ExecutorServiceProvider
- All Known Implementing Classes:
ScheduledThreadPoolExecutorProvider
This mechanism allows Jersey to run in environments that have specific thread management and provisioning requirements,
such as application servers, cloud environments etc.
Dedicated Jersey extension modules or applications running in such environment may provide a custom
implementation of the ScheduledExecutorServiceProvider
interface to customize the default
Jersey runtime thread management & provisioning strategy in order to comply with the threading requirements,
models and policies specific to each particular environment.
qualifier
annotation. This qualifier is then used to createAndInitialize a qualified injection point
for injecting the scheduled executor service instance provided by the annotated provider. Named
providers are also supported. For example:
@Named("my-scheduler") public MySchedulerProvider implements ScheduledExecutorServiceProvider { ... } ... // Injecting ScheduledExecutorService provided by the MySchedulerProvider @Inject @Named("my-scheduler") ScheduledExecutorService myScheduler;
- Since:
- 2.18
- Author:
- Marek Potociar
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGet a scheduled executor service to be used by Jersey client or server runtime to schedule execution of specific tasks.Methods inherited from interface org.glassfish.jersey.spi.ExecutorServiceProvider
dispose
-
Method Details
-
getExecutorService
ScheduledExecutorService getExecutorService()Get a scheduled executor service to be used by Jersey client or server runtime to schedule execution of specific tasks.This method is usually invoked just once at either Jersey client or server application runtime initialization, it may however be invoked multiple times. Once the instance of the provided scheduled executor service is not needed anymore by Jersey application runtime, it will be
disposed
. This typically happens in one of the following situations:- Jersey client instance is closed (client runtime is shut down).
- Jersey container running a server-side Jersey application is shut down.
- Jersey server-side application is un-deployed.
- Specified by:
getExecutorService
in interfaceExecutorServiceProvider
- Returns:
- a scheduled executor service. Must not return
null
.
-