mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Call Thread.currentThread().interrupt() when handling interruption.
This commit is contained in:
@@ -6,6 +6,7 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -19,6 +20,9 @@ class AndroidExecutorImpl implements AndroidExecutor {
|
||||
|
||||
private static final int SHUTDOWN = 0, RUN = 1;
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(AndroidExecutorImpl.class.getName());
|
||||
|
||||
private final Runnable loop;
|
||||
private final AtomicBoolean started = new AtomicBoolean(false);
|
||||
private final CountDownLatch startLatch = new CountDownLatch(1);
|
||||
@@ -43,6 +47,7 @@ class AndroidExecutorImpl implements AndroidExecutor {
|
||||
try {
|
||||
startLatch.await();
|
||||
} catch(InterruptedException e) {
|
||||
LOG.warning("Interrupted while starting executor thread");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ public class BriarActivity extends RoboFragmentActivity {
|
||||
service.waitForShutdown();
|
||||
} catch(InterruptedException e) {
|
||||
LOG.warning("Interrupted while waiting for service");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
finishAndExit();
|
||||
}
|
||||
|
||||
@@ -261,7 +261,8 @@ public class TestingActivity extends BriarActivity implements OnClickListener {
|
||||
}
|
||||
});
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
LOG.warning("Interrupted while getting BluetoothAdapter");
|
||||
Thread.currentThread().interrupt();
|
||||
} catch(ExecutionException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,8 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
}
|
||||
});
|
||||
} catch(InterruptedException e) {
|
||||
throw new IOException(e.toString());
|
||||
Thread.currentThread().interrupt();
|
||||
throw new IOException("Interrupted while getting BluetoothAdapter");
|
||||
} catch(ExecutionException e) {
|
||||
throw new IOException(e.toString());
|
||||
}
|
||||
@@ -427,6 +428,7 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
addresses = discoverDevices(end - now);
|
||||
} catch(InterruptedException e) {
|
||||
LOG.warning("Interrupted while discovering devices");
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
// Connect to any device with the right UUID
|
||||
|
||||
@@ -178,6 +178,7 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
}
|
||||
} catch(InterruptedException e1) {
|
||||
LOG.warning("Interrupted while starting Tor");
|
||||
Thread.currentThread().interrupt();
|
||||
return false;
|
||||
}
|
||||
// Now we should be able to connect to the new process
|
||||
@@ -471,6 +472,8 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
} catch(InterruptedException e) {
|
||||
LOG.warning("Interrupted while creating hidden service");
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Publish the hidden service's onion hostname in transport properties
|
||||
|
||||
@@ -159,6 +159,7 @@ class ConnectorGroup extends Thread implements InvitationTask {
|
||||
for(Connector c : connectors) c.join();
|
||||
} catch(InterruptedException e) {
|
||||
LOG.warning("Interrupted while waiting for connectors");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
// If none of the threads connected, inform the listeners
|
||||
if(!connected.get()) {
|
||||
|
||||
@@ -252,6 +252,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
}
|
||||
} catch(InterruptedException e) {
|
||||
LOG.warning("Interrupted while waiting for task");
|
||||
Thread.currentThread().interrupt();
|
||||
dispose(true, true);
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
|
||||
Reference in New Issue
Block a user