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