Annotation Interface BackgroundScheduler

@Target({PARAMETER,FIELD,METHOD,TYPE}) @Retention(RUNTIME) @Documented @Qualifier public @interface BackgroundScheduler
Injection qualifier that can be used to inject a ScheduledExecutorService instance used by Jersey to execute background timed/scheduled tasks.

A scheduled executor service instance injected using this injection qualifier can be customized by registering a custom ScheduledExecutorServiceProvider implementation that is itself annotated with the @BackgroundScheduler annotation.

Typically, when facing a need to execute a scheduled background task, you would be creating a new standalone executor service that would be using a new standalone thread pool. This would however break the ability of Jersey to run in environments that have specific thread management and provisioning requirements. In order to simplify and unify programming model for scheduling background tasks in Jersey runtime, Jersey provides an this qualifier to inject a common, task scheduler that is properly configured to support customizable runtime thread .

Marek Potociar
See Also: