mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 10:15:52 +00:00
Orchid: fix infinite task creation loop when shutting down
This commit is contained in:
parent
5be769d4ca
commit
de3665f734
@ -18,4 +18,6 @@ public interface ConnectionCache {
|
|||||||
Connection getConnectionTo(Router router, boolean isDirectoryConnection) throws InterruptedException, ConnectionTimeoutException, ConnectionFailedException, ConnectionHandshakeException;
|
Connection getConnectionTo(Router router, boolean isDirectoryConnection) throws InterruptedException, ConnectionTimeoutException, ConnectionFailedException, ConnectionHandshakeException;
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
boolean isClosed();
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,11 @@ public class CircuitCreationTask implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void buildCircuitIfNeeded() {
|
private void buildCircuitIfNeeded() {
|
||||||
|
if (connectionCache.isClosed()) {
|
||||||
|
logger.warning("Not building circuits, because connection cache is closed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final List<StreamExitRequest> pendingExitStreams = circuitManager.getPendingExitStreams();
|
final List<StreamExitRequest> pendingExitStreams = circuitManager.getPendingExitStreams();
|
||||||
final List<PredictedPortTarget> predictedPorts = predictor.getPredictedPortTargets();
|
final List<PredictedPortTarget> predictedPorts = predictor.getPredictedPortTargets();
|
||||||
final List<ExitTarget> exitTargets = new ArrayList<ExitTarget>();
|
final List<ExitTarget> exitTargets = new ArrayList<ExitTarget>();
|
||||||
|
@ -101,6 +101,11 @@ public class ConnectionCacheImpl implements ConnectionCache, DashboardRenderable
|
|||||||
scheduledExecutor.shutdownNow();
|
scheduledExecutor.shutdownNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isClosed() {
|
||||||
|
return isClosed;
|
||||||
|
}
|
||||||
|
|
||||||
public Connection getConnectionTo(Router router, boolean isDirectoryConnection) throws InterruptedException, ConnectionTimeoutException, ConnectionFailedException, ConnectionHandshakeException {
|
public Connection getConnectionTo(Router router, boolean isDirectoryConnection) throws InterruptedException, ConnectionTimeoutException, ConnectionFailedException, ConnectionHandshakeException {
|
||||||
if(isClosed) {
|
if(isClosed) {
|
||||||
throw new IllegalStateException("ConnectionCache has been closed");
|
throw new IllegalStateException("ConnectionCache has been closed");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user