mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Merged IncomingConnectionExecutor and PluginExecutor into IoExecutor.
We don't need two separate executors for long-running IO threads.
This commit is contained in:
@@ -32,7 +32,7 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(ModemPlugin.class.getName());
|
||||
|
||||
private final Executor pluginExecutor;
|
||||
private final Executor ioExecutor;
|
||||
private final ModemFactory modemFactory;
|
||||
private final SerialPortList serialPortList;
|
||||
private final DuplexPluginCallback callback;
|
||||
@@ -43,11 +43,11 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
private volatile boolean running = false;
|
||||
private volatile Modem modem = null;
|
||||
|
||||
ModemPlugin(Executor pluginExecutor, ModemFactory modemFactory,
|
||||
ModemPlugin(Executor ioExecutor, ModemFactory modemFactory,
|
||||
SerialPortList serialPortList, DuplexPluginCallback callback,
|
||||
int maxFrameLength, long maxLatency, long pollingInterval,
|
||||
boolean shuffle) {
|
||||
this.pluginExecutor = pluginExecutor;
|
||||
this.ioExecutor = ioExecutor;
|
||||
this.modemFactory = modemFactory;
|
||||
this.serialPortList = serialPortList;
|
||||
this.callback = callback;
|
||||
@@ -112,7 +112,7 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
|
||||
public void poll(Collection<ContactId> connected) {
|
||||
if(!connected.isEmpty()) return; // One at a time please
|
||||
pluginExecutor.execute(new Runnable() {
|
||||
ioExecutor.execute(new Runnable() {
|
||||
public void run() {
|
||||
poll();
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ public class ModemPluginFactory implements DuplexPluginFactory {
|
||||
private static final long MAX_LATENCY = 60 * 1000; // 1 minute
|
||||
private static final long POLLING_INTERVAL = 60 * 60 * 1000; // 1 hour
|
||||
|
||||
private final Executor pluginExecutor;
|
||||
private final Executor ioExecutor;
|
||||
private final ModemFactory modemFactory;
|
||||
private final SerialPortList serialPortList;
|
||||
|
||||
public ModemPluginFactory(Executor pluginExecutor,
|
||||
public ModemPluginFactory(Executor ioExecutor,
|
||||
ReliabilityLayerFactory reliabilityFactory) {
|
||||
this.pluginExecutor = pluginExecutor;
|
||||
modemFactory = new ModemFactoryImpl(pluginExecutor, reliabilityFactory);
|
||||
this.ioExecutor = ioExecutor;
|
||||
modemFactory = new ModemFactoryImpl(ioExecutor, reliabilityFactory);
|
||||
serialPortList = new SerialPortListImpl();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ModemPluginFactory implements DuplexPluginFactory {
|
||||
// This plugin is not enabled by default
|
||||
String enabled = callback.getConfig().get("enabled");
|
||||
if(StringUtils.isNullOrEmpty(enabled)) return null;
|
||||
return new ModemPlugin(pluginExecutor, modemFactory, serialPortList,
|
||||
return new ModemPlugin(ioExecutor, modemFactory, serialPortList,
|
||||
callback, MAX_FRAME_LENGTH, MAX_LATENCY, POLLING_INTERVAL,
|
||||
true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user