mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 10:15:52 +00:00
PeerGroup: Ignore an IllegalStateException from the ping timer that can be thrown occasionally during a shutdown race.
This commit is contained in:
parent
67f3605570
commit
52b478a6f8
@ -918,7 +918,7 @@ public class PeerGroup extends AbstractIdleService implements TransactionBroadca
|
|||||||
final long interval = getPingIntervalMsec();
|
final long interval = getPingIntervalMsec();
|
||||||
if (interval <= 0)
|
if (interval <= 0)
|
||||||
return; // Disabled.
|
return; // Disabled.
|
||||||
vPingTimer.schedule(new TimerTask() {
|
final TimerTask task = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@ -929,7 +929,13 @@ public class PeerGroup extends AbstractIdleService implements TransactionBroadca
|
|||||||
log.warn("{}: Exception whilst trying to ping peer: {}", peer, e.toString());
|
log.warn("{}: Exception whilst trying to ping peer: {}", peer, e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, interval);
|
};
|
||||||
|
try {
|
||||||
|
vPingTimer.schedule(task, interval);
|
||||||
|
} catch (IllegalStateException ignored) {
|
||||||
|
// This can happen if there's a shutdown race and this runnable is executing whilst the timer is
|
||||||
|
// simultaneously cancelled.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
pingRunnable[0].run();
|
pingRunnable[0].run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user