Debugging Bluetooth threading issues.

This commit is contained in:
akwizgran
2011-12-09 22:20:32 +00:00
parent 4671b50b37
commit 5ba5887565
17 changed files with 59 additions and 57 deletions

View File

@@ -1,8 +1,8 @@
package net.sf.briar.plugins;
import java.util.Collection;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicInteger;
import net.sf.briar.BriarTestCase;
@@ -43,7 +43,7 @@ public class PluginManagerImplTest extends BriarTestCase {
with(any(TransportProperties.class)));
oneOf(poller).stop();
}});
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
ExecutorService executor = Executors.newCachedThreadPool();
PluginManagerImpl p = new PluginManagerImpl(executor, db, poller,
dispatcher, uiCallback);
// We expect either 2 or 3 plugins to be started, depending on whether

View File

@@ -3,7 +3,7 @@ package net.sf.briar.plugins.bluetooth;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Executor;
import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportConfig;
@@ -24,7 +24,7 @@ public class BluetoothClientTest extends StreamClientTest {
// Create the plugin
callback = new ClientCallback(new TransportConfig(),
new TransportProperties(), remote);
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
Executor executor = Executors.newCachedThreadPool();
plugin = new BluetoothPlugin(executor, callback, 0L);
}

View File

@@ -2,7 +2,7 @@ package net.sf.briar.plugins.bluetooth;
import java.util.Collections;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Executor;
import net.sf.briar.api.TransportConfig;
import net.sf.briar.api.TransportProperties;
@@ -19,7 +19,7 @@ public class BluetoothServerTest extends StreamServerTest {
// Create the plugin
callback = new ServerCallback(new TransportConfig(), local,
Collections.singletonMap(contactId, new TransportProperties()));
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
Executor executor = Executors.newCachedThreadPool();
plugin = new BluetoothPlugin(executor, callback, 0L);
}

View File

@@ -3,7 +3,7 @@ package net.sf.briar.plugins.socket;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Executor;
import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportConfig;
@@ -24,7 +24,7 @@ public class LanSocketClientTest extends StreamClientTest {
// Create the plugin
callback = new ClientCallback(new TransportConfig(),
new TransportProperties(), remote);
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
Executor executor = Executors.newCachedThreadPool();
plugin = new LanSocketPlugin(executor, callback, 0L);
}

View File

@@ -2,7 +2,7 @@ package net.sf.briar.plugins.socket;
import java.util.Collections;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Executor;
import net.sf.briar.api.TransportConfig;
import net.sf.briar.api.TransportProperties;
@@ -16,7 +16,7 @@ public class LanSocketServerTest extends StreamServerTest {
callback = new ServerCallback(new TransportConfig(),
new TransportProperties(),
Collections.singletonMap(contactId, new TransportProperties()));
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
Executor executor = Executors.newCachedThreadPool();
plugin = new LanSocketPlugin(executor, callback, 0L);
}

View File

@@ -8,7 +8,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -30,7 +30,7 @@ public class SimpleSocketPluginTest extends BriarTestCase {
StreamCallback callback = new StreamCallback();
callback.local.put("internal", "127.0.0.1");
callback.local.put("port", "0");
ScheduledExecutorService e = Executors.newScheduledThreadPool(1);
Executor e = Executors.newCachedThreadPool();
SimpleSocketPlugin plugin = new SimpleSocketPlugin(e, callback, 0L);
plugin.start();
// The plugin should have bound a socket and stored the port number
@@ -64,7 +64,7 @@ public class SimpleSocketPluginTest extends BriarTestCase {
@Test
public void testOutgoingConnection() throws Exception {
StreamCallback callback = new StreamCallback();
ScheduledExecutorService e = Executors.newScheduledThreadPool(1);
Executor e = Executors.newCachedThreadPool();
SimpleSocketPlugin plugin = new SimpleSocketPlugin(e, callback, 0L);
plugin.start();
// Listen on a local port