From f108de7fc4fddeaf70f73996fd4e9b62b2f692c0 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 07 Nov 2006 21:54:31 +0000
Subject: [PATCH] Update the work queue API to provide new isIdle and waitUntilIdle methods that may be used to determine whether the queue is currently idle (i.e., that it is not being used to process any operations).
---
opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
index e59bc4f..e704054 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
@@ -125,6 +125,24 @@
/**
+ * Indicates whether this worker thread is actively processing a request.
+ * Note that this is a point-in-time determination and if a reliable answer is
+ * expected then the server should impose some external constraint to ensure
+ * that no new requests are enqueued.
+ *
+ * @return {@code true} if this worker thread is actively processing a
+ * request, or {@code false} if it is idle.
+ */
+ public boolean isActive()
+ {
+ assert debugEnter(CLASS_NAME, "isActive");
+
+ return (isAlive() && (operation != null));
+ }
+
+
+
+ /**
* Operates in a loop, retrieving the next request from the work queue,
* processing it, and then going back to the queue for more.
*/
--
Gitblit v1.10.0