@Contract public interface ScheduledExecutorServiceProvider extends ExecutorServiceProvider
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;
ExecutorServiceProvider
,
ScheduledThreadPoolExecutorProvider
Modifier and Type | Method and Description |
---|---|
ScheduledExecutorService |
getExecutorService()
Get a scheduled executor service to be used by Jersey client or server runtime to schedule execution of
specific tasks.
|
dispose
ScheduledExecutorService getExecutorService()
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:
getExecutorService
in interface ExecutorServiceProvider
null
.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.