mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Fix test and poller instantiation
This commit is contained in:
@@ -108,6 +108,13 @@ class PluginManagerImpl implements PluginManager, Service {
|
||||
@Override
|
||||
public void startService() throws ServiceException {
|
||||
if (used.getAndSet(true)) throw new IllegalStateException();
|
||||
// Instantiate the poller
|
||||
if (pluginConfig.shouldPoll()) {
|
||||
LOG.info("Starting poller");
|
||||
Poller poller = new Poller(ioExecutor, scheduler, connectionManager,
|
||||
connectionRegistry, this, random, clock);
|
||||
eventBus.addListener(poller);
|
||||
}
|
||||
// Instantiate the simplex plugins and start them asynchronously
|
||||
LOG.info("Starting simplex plugins");
|
||||
for (SimplexPluginFactory f : pluginConfig.getSimplexFactories()) {
|
||||
@@ -140,13 +147,6 @@ class PluginManagerImpl implements PluginManager, Service {
|
||||
ioExecutor.execute(new PluginStarter(d, startLatch));
|
||||
}
|
||||
}
|
||||
// Instantiate the poller
|
||||
if (pluginConfig.shouldPoll()) {
|
||||
LOG.info("Starting poller");
|
||||
Poller poller = new Poller(ioExecutor, scheduler, connectionManager,
|
||||
connectionRegistry, this, random, clock);
|
||||
eventBus.addListener(poller);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,9 +40,7 @@ public class PluginManagerImplTest extends BrambleTestCase {
|
||||
setThreadingPolicy(new Synchroniser());
|
||||
}};
|
||||
Executor ioExecutor = Executors.newSingleThreadExecutor();
|
||||
RejectedExecutionHandler policy =
|
||||
new ScheduledThreadPoolExecutor.DiscardPolicy();
|
||||
ScheduledExecutorService scheduler = new ScheduledThreadPoolExecutor(1, policy);
|
||||
ScheduledExecutorService scheduler = context.mock(ScheduledExecutorService.class);
|
||||
SecureRandom random = new SecureRandom();
|
||||
Clock clock = context.mock(Clock.class);
|
||||
EventBus eventBus = context.mock(EventBus.class);
|
||||
|
||||
Reference in New Issue
Block a user