aboutsummaryrefslogtreecommitdiffstats
path: root/jrt
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2021-12-16 13:43:23 +0000
committerHåvard Pettersen <havardpe@oath.com>2021-12-16 13:43:23 +0000
commit7c39445c2fed8055231a23347d207f3dd5ede6b4 (patch)
treeb41289129964908080058fa75a8d2bb9da5fe3d6 /jrt
parent1eefb9854bcd7ca264889239b32e7fc8c8830672 (diff)
add ability to wake up the transport thread explicitly
Diffstat (limited to 'jrt')
-rw-r--r--jrt/src/com/yahoo/jrt/TransportThread.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/jrt/src/com/yahoo/jrt/TransportThread.java b/jrt/src/com/yahoo/jrt/TransportThread.java
index 4f951ad8259..a3f1773c814 100644
--- a/jrt/src/com/yahoo/jrt/TransportThread.java
+++ b/jrt/src/com/yahoo/jrt/TransportThread.java
@@ -269,6 +269,23 @@ public class TransportThread {
}
/**
+ * Wake up this transport thread explicitly.
+ **/
+ public void wakeup() {
+ selector.wakeup();
+ }
+
+ /**
+ * Wake up this transport thread explicitly, but only if the
+ * calling thread is not the transport thread itself.
+ **/
+ public void wakeup_if_not_self() {
+ if (Thread.currentThread() != thread) {
+ wakeup();
+ }
+ }
+
+ /**
* Synchronize with the transport thread. This method will block
* until all commands issued before this method was invoked has
* completed. If the transport thread has been shut down (or is in