From ed1fdf40855eeff91b1824c5b1de8159ba028e5f Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 15 Jan 2018 16:02:09 +0100 Subject: [PATCH] Added isShutdown() query --- src/dorkbox/network/connection/EndPoint.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/dorkbox/network/connection/EndPoint.java b/src/dorkbox/network/connection/EndPoint.java index b101f0ea..e03cfbc6 100644 --- a/src/dorkbox/network/connection/EndPoint.java +++ b/src/dorkbox/network/connection/EndPoint.java @@ -79,6 +79,7 @@ class EndPoint { protected final Class type; protected final Object shutdownInProgress = new Object(); + private volatile boolean isShutdown = false; // the eventLoop groups are used to track and manage the event loops for startup/shutdown private final List eventLoopGroups = new ArrayList(8); @@ -320,6 +321,8 @@ class EndPoint { // we also want to stop the thread group threadGroup.interrupt(); + + isShutdown = true; } // tell the blocked "bind" method that it may continue (and exit) @@ -339,6 +342,16 @@ class EndPoint { } } + /** + * @return true if we have already shutdown, false otherwise + */ + public final + boolean isShutdown() { + synchronized (shutdownInProgress) { + return isShutdown; + } + } + @Override public String toString() {