From 62c7d9970ee34d102a78ce72a459274a97721cc6 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 06 Jun 2014 14:50:38 +0000
Subject: [PATCH] OPENDJ-1453 (CR-3697) Change time heart beat change numbers should be synced with updates

---
 opendj3-server-dev/src/server/org/opends/server/extensions/TraditionalWorkerThread.java |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/extensions/TraditionalWorkerThread.java b/opendj3-server-dev/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
index 9508ff9..81cdcbd 100644
--- a/opendj3-server-dev/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
+++ b/opendj3-server-dev/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
@@ -26,7 +26,6 @@
  */
 package org.opends.server.extensions;
 
-
 import java.util.Map;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -40,7 +39,6 @@
 import static org.opends.messages.CoreMessages.*;
 import static org.opends.server.util.StaticUtils.*;
 
-
 /**
  * This class defines a data structure for storing and interacting with a
  * Directory Server worker thread.
@@ -57,7 +55,7 @@
   private volatile boolean shutdownRequested;
 
   /**
-   * Indicates whether this thread was stopped because the server threadnumber
+   * Indicates whether this thread was stopped because the server thread number
    * was reduced.
    */
   private boolean stoppedByReducedThreadNumber;
@@ -66,13 +64,13 @@
   private boolean waitingForWork;
 
   /** The operation that this worker thread is currently processing. */
-  private Operation operation;
+  private volatile Operation operation;
 
   /** The handle to the actual thread for this worker thread. */
   private Thread workerThread;
 
   /** The work queue that this worker thread will service. */
-  private TraditionalWorkQueue workQueue;
+  private final TraditionalWorkQueue workQueue;
 
 
 
@@ -123,7 +121,7 @@
    */
   public boolean isActive()
   {
-    return (isAlive() && (operation != null));
+    return isAlive() && operation != null;
   }
 
 
@@ -142,7 +140,7 @@
       try
       {
         waitingForWork = true;
-        operation = null;
+        operation = null; // this line is necessary because next line can block
         operation = workQueue.nextOperation(this);
         waitingForWork = false;
 

--
Gitblit v1.10.0