summaryrefslogtreecommitdiffstats
path: root/jrt
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2019-05-13 14:11:23 +0000
committerHåvard Pettersen <havardpe@oath.com>2019-05-13 14:11:23 +0000
commite1c3ebb378d302514a714a2d5610e4e0ee7e9c03 (patch)
tree1fa2fb2ccbfe3b627d8b1f97e8d85d31d7d5a69d /jrt
parent176abec811a2f93442a95a4dc23196abe33a3bc9 (diff)
perform all 'state' changes in the transport thread
Diffstat (limited to 'jrt')
-rw-r--r--jrt/src/com/yahoo/jrt/TransportThread.java13
1 files 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;
}