mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Introduce a @Scheduler annotation
and make sure work is offloaded to an executor, so exceptions can be caught.
This commit is contained in:
25
briar-api/src/org/briarproject/api/system/Scheduler.java
Normal file
25
briar-api/src/org/briarproject/api/system/Scheduler.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package org.briarproject.api.system;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import javax.inject.Qualifier;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.PARAMETER;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Annotation for injecting a scheduled executor service
|
||||
* that can be used to schedule the execution of tasks.
|
||||
* <p>
|
||||
* The service should <b>only</b> be used for running tasks on other executors
|
||||
* at scheduled times.
|
||||
* No significant work should be run by the service itself!
|
||||
*/
|
||||
@Qualifier
|
||||
@Target({FIELD, METHOD, PARAMETER})
|
||||
@Retention(RUNTIME)
|
||||
public @interface Scheduler {
|
||||
}
|
||||
Reference in New Issue
Block a user