mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +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:
@@ -2,6 +2,7 @@ package org.briarproject.system;
|
||||
|
||||
import org.briarproject.api.lifecycle.LifecycleManager;
|
||||
import org.briarproject.api.system.Clock;
|
||||
import org.briarproject.api.system.Scheduler;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -17,6 +18,7 @@ public class SystemModule {
|
||||
|
||||
public static class EagerSingletons {
|
||||
@Inject
|
||||
@Scheduler
|
||||
ScheduledExecutorService scheduledExecutorService;
|
||||
}
|
||||
|
||||
@@ -33,6 +35,7 @@ public class SystemModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Scheduler
|
||||
ScheduledExecutorService provideScheduledExecutorService(
|
||||
LifecycleManager lifecycleManager) {
|
||||
lifecycleManager.registerForShutdown(scheduler);
|
||||
|
||||
Reference in New Issue
Block a user