From 7c39445c2fed8055231a23347d207f3dd5ede6b4 Mon Sep 17 00:00:00 2001 From: HÃ¥vard Pettersen Date: Thu, 16 Dec 2021 13:43:23 +0000 Subject: add ability to wake up the transport thread explicitly --- jrt/src/com/yahoo/jrt/TransportThread.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'jrt/src') 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 @@ -268,6 +268,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 -- cgit v1.2.3