From e1c3ebb378d302514a714a2d5610e4e0ee7e9c03 Mon Sep 17 00:00:00 2001 From: HÃ¥vard Pettersen Date: Mon, 13 May 2019 14:11:23 +0000 Subject: perform all 'state' changes in the transport thread --- jrt/src/com/yahoo/jrt/TransportThread.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jrt/src/com/yahoo/jrt/TransportThread.java b/jrt/src/com/yahoo/jrt/TransportThread.java index 8f4f49b8888..bb41e67c3f1 100644 --- a/jrt/src/com/yahoo/jrt/TransportThread.java +++ b/jrt/src/com/yahoo/jrt/TransportThread.java @@ -331,13 +331,14 @@ public class TransportThread { parent.notifyDone(this); } - TransportThread shutdown() { - synchronized (this) { - if (state == OPEN) { - state = CLOSING; - selector.wakeup(); - } + private synchronized void handleShutdown() { + if (state == OPEN) { + state = CLOSING; } + } + + TransportThread shutdown() { + postCommand(this::handleShutdown); return this; } -- cgit v1.2.3