mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +00:00
open offer manager completes shut down after thread pool
This commit is contained in:
parent
902accb290
commit
fabec9d396
1 changed files with 9 additions and 9 deletions
|
@ -331,20 +331,20 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
// Force broadcaster to send out immediately, otherwise we could have a 2 sec delay until the
|
||||
// bundled messages sent out.
|
||||
broadcaster.flush();
|
||||
|
||||
if (completeHandler != null) {
|
||||
// For typical number of offers we are tolerant with delay to give enough time to broadcast.
|
||||
// If number of offers is very high we limit to 3 sec. to not delay other shutdown routines.
|
||||
int delay = Math.min(3000, size * 200 + 500);
|
||||
UserThread.runAfter(completeHandler, delay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
// For typical number of offers we are tolerant with delay to give enough time to broadcast.
|
||||
// If number of offers is very high we limit to 3 sec. to not delay other shutdown routines.
|
||||
long delayMs = Math.min(3000, size * 200 + 500);
|
||||
GenUtils.waitFor(delayMs);;
|
||||
}, THREAD_ID);
|
||||
} else {
|
||||
broadcaster.flush();
|
||||
if (completeHandler != null)
|
||||
completeHandler.run();
|
||||
}
|
||||
|
||||
// shut down thread pool
|
||||
shutDownThreadPool();
|
||||
|
||||
// invoke completion handler
|
||||
if (completeHandler != null) completeHandler.run();
|
||||
}
|
||||
|
||||
private void shutDownThreadPool() {
|
||||
|
|
Loading…
Reference in a new issue