From fbda6e0892dcfcc8dd43d21f6fb134aabb8d0cac Mon Sep 17 00:00:00 2001
From: jarnou <jarnou@localhost>
Date: Tue, 03 Jul 2007 09:29:17 +0000
Subject: [PATCH] Commits the refactoring of the core server to provide support for proxy/distribution/virtual functionnalities. This includes the new set of local operations, as well as the workflow and networkgroup support.
---
opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java b/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
index 8953361..1a87228 100644
--- a/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
+++ b/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
@@ -61,6 +61,7 @@
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
+import org.opends.server.types.AbstractOperation;
@@ -122,7 +123,7 @@
private int numWorkerThreads;
// The queue that will be used to actually hold the pending operations.
- private LinkedBlockingQueue<Operation> opQueue;
+ private LinkedBlockingQueue<AbstractOperation> opQueue;
// The lock used to provide threadsafe access for the queue.
private ReentrantLock queueLock;
@@ -167,11 +168,11 @@
// Create the actual work queue.
if (maxCapacity > 0)
{
- opQueue = new LinkedBlockingQueue<Operation>(maxCapacity);
+ opQueue = new LinkedBlockingQueue<AbstractOperation>(maxCapacity);
}
else
{
- opQueue = new LinkedBlockingQueue<Operation>();
+ opQueue = new LinkedBlockingQueue<AbstractOperation>();
}
@@ -295,8 +296,7 @@
* down or the pending operation queue is already
* at its maximum capacity).
*/
- @Override()
- public void submitOperation(Operation operation)
+ public void submitOperation(AbstractOperation operation)
throws DirectoryException
{
if (shutdownRequested)
@@ -331,7 +331,7 @@
* if the server is shutting down and no more operations will be
* processed.
*/
- public Operation nextOperation(TraditionalWorkerThread workerThread)
+ public AbstractOperation nextOperation(TraditionalWorkerThread workerThread)
{
return retryNextOperation(workerThread, 0);
}
@@ -354,7 +354,8 @@
* if the server is shutting down and no more operations will be
* processed, or if there have been too many consecutive failures.
*/
- private Operation retryNextOperation(TraditionalWorkerThread workerThread,
+ private AbstractOperation retryNextOperation(
+ TraditionalWorkerThread workerThread,
int numFailures)
{
// See if we should kill off this thread. This could be necessary if the
@@ -414,7 +415,7 @@
{
while (true)
{
- Operation nextOperation = opQueue.poll(5, TimeUnit.SECONDS);
+ AbstractOperation nextOperation = opQueue.poll(5, TimeUnit.SECONDS);
if (nextOperation == null)
{
// There was no work to do in the specified length of time. See if
@@ -512,7 +513,7 @@
* @return <CODE>true</CODE> if the provided request was present in the queue
* and was removed successfully, or <CODE>false</CODE> it not.
*/
- public boolean removeOperation(Operation operation)
+ public boolean removeOperation(AbstractOperation operation)
{
return opQueue.remove(operation);
}
@@ -642,20 +643,22 @@
try
{
- LinkedBlockingQueue<Operation> newOpQueue;
+ LinkedBlockingQueue<AbstractOperation> newOpQueue;
if (newMaxCapacity > 0)
{
- newOpQueue = new LinkedBlockingQueue<Operation>(newMaxCapacity);
+ newOpQueue =
+ new LinkedBlockingQueue<AbstractOperation>(newMaxCapacity);
}
else
{
- newOpQueue = new LinkedBlockingQueue<Operation>();
+ newOpQueue = new LinkedBlockingQueue<AbstractOperation>();
}
- LinkedBlockingQueue<Operation> oldOpQueue = opQueue;
+ LinkedBlockingQueue<AbstractOperation> oldOpQueue = opQueue;
opQueue = newOpQueue;
- LinkedList<Operation> pendingOps = new LinkedList<Operation>();
+ LinkedList<AbstractOperation> pendingOps =
+ new LinkedList<AbstractOperation>();
oldOpQueue.drainTo(pendingOps);
@@ -665,10 +668,10 @@
// loop a few times to get everything in there.
while (! pendingOps.isEmpty())
{
- Iterator<Operation> iterator = pendingOps.iterator();
+ Iterator<AbstractOperation> iterator = pendingOps.iterator();
while (iterator.hasNext())
{
- Operation o = iterator.next();
+ AbstractOperation o = iterator.next();
try
{
if (newOpQueue.offer(o, 1000, TimeUnit.MILLISECONDS))
--
Gitblit v1.10.0