You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2013/12/08 18:55:11 UTC

svn commit: r1549080 - in /manifoldcf/branches/CONNECTORS-781/framework: agents/src/main/java/org/apache/manifoldcf/agents/system/ core/src/main/java/org/apache/manifoldcf/core/connectorpool/ core/src/main/java/org/apache/manifoldcf/core/database/ core...

Author: kwright
Date: Sun Dec  8 17:55:11 2013
New Revision: 1549080

URL: http://svn.apache.org/r1549080
Log:
Debug pool allocation

Modified:
    manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java
    manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java
    manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
    manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java
    manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java
    manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java
    manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java
    manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
    manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java
    manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/IdleCleanupThread.java
    manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java

Modified: manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java Sun Dec  8 17:55:11 2013
@@ -67,7 +67,7 @@ public class IdleCleanupThread extends T
           cacheManager.expireObjects(System.currentTimeMillis());
           
           // Sleep for the retry interval.
-          ManifoldCF.sleep(15000L);
+          ManifoldCF.sleep(5000L);
         }
         catch (ManifoldCFException e)
         {

Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java Sun Dec  8 17:55:11 2013
@@ -47,45 +47,9 @@ public abstract class ConnectorPool<T ex
   // "data type" name - only in the local pool will we pay any attention to config info and class name, and flush those handles
   // that get returned that have the wrong info attached.
 
-  // Gating whether a connector instance should be created occurs when someone tries to grab a connector instance.
-  // When it comes time to get a handle in the local pool, there are two situations:
-  // (1) We know that the handle is available locally.
-  // (2) The handle is not available locally, but may be available globally.
-  // In case (2), we wait until the allocated global handle count is less than the maximum, and only then do we grab a handle
-  // (incrementing the service counter when we do that).  This requires polling - but we will poll relatively infrequently.
-
-  // Determining how many connections THIS pool instance should hold on to locally is done at the time a connector
-  // instance is freed.  A decision is made whether to discard the instance (or another that we're keeping around),
-  // or keep it.  The main factors that go into that decision are the following:
-  // - Are we in excess of the local fixed quota?
-  // - Are we in excess of the local transient quota?
-  // The quotas are determined at polling time (?).  The transient quota is calculated by each instance, and uses the
-  // following information: (a) how many registered services are there; (b) how many total handles are allowed; (c)
-  // how many handles are actually connected at the time for each of services.  The goal is to apportion handles to the
-  // services that are actually using them; this can change dynamically over time.
+  /** Target calc lock prefix */
+  protected final static String targetCalcLockPrefix = "_POOLTARGET_";
   
-  // Two numbers each service posts: "in-use" and "target".  At no time does a service *ever* post either a "target"
-  // that, together with all other active service targets, is in excess of the max.  Also, at no time a service post
-  // a target that, when added to the other "in-use" values, exceeds the max.  If the "in-use" values everywhere else
-  // already equal or exceed the max, then the target will be zero.
-  // The target quota is calculated as follows:
-  // (1) Target is summed, excluding ours.  This is GlobalTarget.
-  // (2) In-use is summed, excluding ours.  This is GlobalInUse.
-  // (3) Our MaximumTarget is computed, which is Maximum - GlobalTarget or Maximum - GlobalInUse, whichever is
-  //     smaller, but never less than zero.
-  // (4) Our FairTarget is computed.  The FairTarget divides the Maximum by the number of services, and adds
-  //     1 randomly based on the remainder.
-  // (5) We compute OptimalTarget as follows: We start with current local target.  If current local target
-  //    exceeds current local in-use count, we adjust OptimalTarget downward by one.  Otherwise we increase it
-  //    by one.
-  // (6) Finally, we compute Target by taking the minimum of MaximumTarget, FairTarget, and OptimalTarget.
-  
-  /** Target data name */
-  protected final String targetDataType = "target";
-  
-  /** In-use data name */
-  protected final String inUseDataType = "in-use";
-
   /** Service type prefix */
   protected final String serviceTypePrefix;
 
@@ -266,24 +230,32 @@ public abstract class ConnectorPool<T ex
     // We want to get handles off the pool and use them.  But the
     // handles we fetch have to have the right config information.
 
-    Pool p;
-    synchronized (poolHash)
-    {
-      p = poolHash.get(connectionName);
-      if (p == null)
-      {
-        p = new Pool(threadContext, maxPoolSize, connectionName);
-        poolHash.put(connectionName,p);
-      }
-      else
-      {
-        p.updateMaximumPoolSize(threadContext, maxPoolSize);
+    // Loop until we successfully get a connector.  This is necessary because the
+    // pool may vanish because it has been closed.
+    while (true)
+    {
+      Pool p;
+      synchronized (poolHash)
+      {
+        p = poolHash.get(connectionName);
+        if (p == null)
+        {
+          p = new Pool(threadContext, maxPoolSize, connectionName);
+          poolHash.put(connectionName,p);
+          // Do an initial poll right away, so we don't have to wait 5 seconds to 
+          // get a connector instance unless they're already all in use.
+          p.pollAll(threadContext);
+        }
+        else
+        {
+          p.updateMaximumPoolSize(threadContext, maxPoolSize);
+        }
       }
-    }
 
-    T rval = p.getConnector(threadContext,className,configInfo);
-
-    return rval;
+      T rval = p.getConnector(threadContext,className,configInfo);
+      if (rval != null)
+        return rval;
+    }
 
   }
 
@@ -393,6 +365,7 @@ public abstract class ConnectorPool<T ex
       {
         Pool p = iter.next();
         p.releaseAll(threadContext);
+        iter.remove();
       }
     }
   }
@@ -404,11 +377,16 @@ public abstract class ConnectorPool<T ex
     return serviceTypePrefix + connectionName;
   }
   
+  protected String buildTargetCalcLockName(String connectionName)
+  {
+    return targetCalcLockPrefix + serviceTypePrefix + connectionName;
+  }
+  
   /** This class represents a value in the pool hash, which corresponds to a given key.
   */
   protected class Pool
   {
-    /** Whether the pool has been shut down or not */
+    /** Whether this pool is alive */
     protected boolean isAlive = true;
     /** The global maximum for this pool */
     protected int globalMax;
@@ -416,6 +394,8 @@ public abstract class ConnectorPool<T ex
     protected final String serviceTypeName;
     /** The (anonymous) service name */
     protected final String serviceName;
+    /** The target calculation lock name */
+    protected final String targetCalcLockName;
     /** Place where we keep unused connector instances */
     protected final List<T> stack = new ArrayList<T>();
     /** The number of local instances we can currently pass out to requesting threads.  Initially zero until pool is apportioned */
@@ -431,6 +411,7 @@ public abstract class ConnectorPool<T ex
       throws ManifoldCFException
     {
       this.globalMax = maxCount;
+      this.targetCalcLockName = buildTargetCalcLockName(connectionName);
       this.serviceTypeName = buildServiceTypeName(connectionName);
       // Now, register and activate service anonymously, and record the service name we get.
       ILockManager lockManager = LockManagerFactory.make(threadContext);
@@ -458,7 +439,7 @@ public abstract class ConnectorPool<T ex
     {
       // numFree represents the number of available connector instances that have not been given out at this moment.
       // So it's the max minus the pool count minus the number in use.
-      while (numFree <= 0)
+      while (isAlive && numFree <= 0)
       {
         try
         {
@@ -469,7 +450,9 @@ public abstract class ConnectorPool<T ex
           throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
         }
       }
-
+      if (!isAlive)
+        return null;
+      
       // We decrement numFree when we hand out a connector instance; we increment numFree when we
       // throw away a connector instance from the pool.
       while (true)
@@ -582,86 +565,90 @@ public abstract class ConnectorPool<T ex
       //    by one.
       // (6) Finally, we compute Target by taking the minimum of MaximumTarget, FairTarget, and OptimalTarget.
 
-      System.out.println("In pollAll for "+serviceTypeName+" "+serviceName);
-      if (!isAlive)
-        return;
-
-      System.out.println("Is alive in pollAll for "+serviceTypeName+" "+serviceName);
-
       ILockManager lockManager = LockManagerFactory.make(threadContext);
-
-      int numServices = lockManager.countActiveServices(serviceTypeName);
-      if (numServices == 0)
-        // Should never happen, but if it does just give up.
-        return;
-      
-      System.out.println("Has active services in pollAll for "+serviceTypeName+" "+serviceName);
-
-      // Compute MaximumTarget
-      int globalTarget = computeGlobalSum(lockManager, targetDataType);
-      int globalInUse = computeGlobalSum(lockManager, inUseDataType);
-      int maximumTarget = globalMax - globalTarget;
-      if (maximumTarget > globalMax - globalInUse)
-        maximumTarget = globalMax - globalInUse;
-      if (maximumTarget < 0)
-        maximumTarget = 0;
-      
-      // Compute FairTarget
-      int fairTarget = globalMax / numServices;
-      int remainder = globalMax % numServices;
-      // Randomly choose whether we get an addition to the FairTarget
-      if (randomNumberGenerator.nextInt(numServices) <= remainder)
-        fairTarget++;
-      
-      // Compute OptimalTarget (and poll connectors while we are at it)
-      int localInUse = localMax - numFree;      // These are the connectors that have been handed out
-      for (T rc : stack)
+      lockManager.enterWriteLock(targetCalcLockName);
+      try
       {
-        // Notify
-        rc.setThreadContext(threadContext);
-        try
+        // Compute MaximumTarget
+        SumClass sumClass = new SumClass(serviceName);
+        lockManager.scanServiceData(serviceTypeName, sumClass);
+        int numServices = sumClass.getNumServices();
+        if (numServices == 0)
+          return;
+        int globalTarget = sumClass.getGlobalTarget();
+        int globalInUse = sumClass.getGlobalInUse();
+        int maximumTarget = globalMax - globalTarget;
+        if (maximumTarget > globalMax - globalInUse)
+          maximumTarget = globalMax - globalInUse;
+        if (maximumTarget < 0)
+          maximumTarget = 0;
+        
+        // Compute FairTarget
+        int fairTarget = globalMax / numServices;
+        int remainder = globalMax % numServices;
+        // Randomly choose whether we get an addition to the FairTarget
+        if (randomNumberGenerator.nextInt(numServices) < remainder)
+          fairTarget++;
+        
+        // Compute OptimalTarget (and poll connectors while we are at it)
+        int localInUse = localMax - numFree;      // These are the connectors that have been handed out
+        for (T rc : stack)
         {
-          rc.poll();
-          if (rc.isConnected())
-            localInUse++;       // Count every pooled connector that is still connected
+          // Notify
+          rc.setThreadContext(threadContext);
+          try
+          {
+            rc.poll();
+            if (rc.isConnected())
+              localInUse++;       // Count every pooled connector that is still connected
+          }
+          finally
+          {
+            rc.clearThreadContext();
+          }
         }
-        finally
+        int optimalTarget = localMax;
+        if (localMax > localInUse)
+          optimalTarget--;
+        else
         {
-          rc.clearThreadContext();
+          // We want a fast ramp up, so make this proportional to globalMax
+          int increment = globalMax >> 2;
+          if (increment < 0)
+            increment = 1;
+          optimalTarget += increment;
         }
+        
+        // Now compute actual target
+        int target = maximumTarget;
+        if (target > fairTarget)
+          target = fairTarget;
+        if (target > optimalTarget)
+          target = optimalTarget;
+        
+        // Write these values to the service data variables.
+        // NOTE that there is a race condition here; the target value depends on all the calculations above being accurate, and not changing out from under us.
+        // So, that's why we have a write lock around the pool calculations.
+        
+        lockManager.updateServiceData(serviceTypeName, serviceName, pack(target, localInUse));
+        
+        // Now, update our localMax
+        if (target == localMax)
+          return;
+        // Compute the number of instances in use locally
+        localInUse = localMax - numFree;
+        localMax = target;
+        // numFree may turn out to be negative here!!  That's okay; we'll just free released connectors
+        // until we enter positive territory again.
+        numFree = localMax - localInUse;
+        notifyAll();
+      }
+      finally
+      {
+        lockManager.leaveWriteLock(targetCalcLockName);
       }
-      int optimalTarget = localMax;
-      if (localMax > localInUse)
-        optimalTarget--;
-      else
-        optimalTarget++;
-      
-      // Now compute actual target
-      int target = maximumTarget;
-      if (target > fairTarget)
-        target = fairTarget;
-      if (target > optimalTarget)
-        target = optimalTarget;
-      
-      System.out.println("Max target: "+maximumTarget+"; fair target: "+fairTarget+"; optimal target: "+optimalTarget+"; localInUse: "+localInUse);
-      
-      // Write these values to the service data variables
-      // NOTE that these can be combined to one, for significant efficiencies MHL
-      lockManager.updateServiceData(serviceTypeName, serviceName, inUseDataType, packInt(localInUse));
-      lockManager.updateServiceData(serviceTypeName, serviceName, targetDataType, packInt(target));
-      
-      // Now, update our localMax
-      changeLocalMaxValue(target);
     }
 
-    protected int computeGlobalSum(ILockManager lockManager, String dataType)
-      throws ManifoldCFException
-    {
-      SumClass sumClass = new SumClass(serviceName);
-      lockManager.scanServiceData(serviceTypeName, dataType, sumClass);
-      return sumClass.getSum();
-    }
-    
     /** Flush unused connectors.
     */
     public synchronized void flushUnused(IThreadContext threadContext)
@@ -689,40 +676,22 @@ public abstract class ConnectorPool<T ex
       throws ManifoldCFException
     {
       flushUnused(threadContext);
-      System.out.println("ENDING SERVICE ACTIVITY!! for "+serviceTypeName+" "+serviceName);
-      new Exception("Bad stuff").printStackTrace();
       
       // End service activity
       isAlive = false;
+      notifyAll();
       ILockManager lockManager = LockManagerFactory.make(threadContext);
       lockManager.endServiceActivity(serviceTypeName, serviceName);
     }
 
-    // Protected methods
-
-    /** Change the localMax value.
-    *@param newLocalMax is the new local max value.
-    */
-    protected synchronized void changeLocalMaxValue(int newLocalMax)
-    {
-      if (newLocalMax == localMax)
-        return;
-      System.out.println("Changing local max for "+serviceTypeName+" "+serviceName+" to "+newLocalMax);
-      // Compute the number of instances in use locally
-      int localInUse = localMax - numFree;
-      localMax = newLocalMax;
-      // numFree may turn out to be negative here!!  That's okay; we'll just free released connectors
-      // until we enter positive territory again.
-      numFree = localMax - localInUse;
-      notifyAll();
-    }
-
   }
 
   protected static class SumClass implements IServiceDataAcceptor
   {
     protected final String serviceName;
-    protected int tally = 0;
+    protected int numServices = 0;
+    protected int globalTargetTally = 0;
+    protected int globalInUseTally = 0;
     
     public SumClass(String serviceName)
     {
@@ -733,34 +702,64 @@ public abstract class ConnectorPool<T ex
     public boolean acceptServiceData(String serviceName, byte[] serviceData)
       throws ManifoldCFException
     {
+      numServices++;
+
       if (!serviceName.equals(this.serviceName))
-        tally += unpackInt(serviceData);
+      {
+        globalTargetTally += unpackTarget(serviceData);
+        globalInUseTally += unpackInUse(serviceData);
+      }
       return false;
     }
 
-    public int getSum()
+    public int getNumServices()
     {
-      return tally;
+      return numServices;
     }
+    
+    public int getGlobalTarget()
+    {
+      return globalTargetTally;
+    }
+    
+    public int getGlobalInUse()
+    {
+      return globalInUseTally;
+    }
+    
   }
   
-  protected static int unpackInt(byte[] data)
+  protected static int unpackTarget(byte[] data)
   {
-    if (data == null || data.length != 4)
+    if (data == null || data.length != 8)
       return 0;
     return ((int)data[0]) & 0xff +
       (((int)data[1]) >> 8) & 0xff +
       (((int)data[2]) >> 16) & 0xff +
       (((int)data[3]) >> 24) & 0xff;
   }
-  
-  protected static byte[] packInt(int value)
+
+  protected static int unpackInUse(byte[] data)
   {
-    byte[] rval = new byte[4];
-    rval[0] = (byte)(value & 0xff);
-    rval[1] = (byte)((value >> 8) & 0xff);
-    rval[2] = (byte)((value >> 16) & 0xff);
-    rval[3] = (byte)((value >> 24) & 0xff);
+    if (data == null || data.length != 8)
+      return 0;
+    return ((int)data[4]) & 0xff +
+      (((int)data[5]) >> 8) & 0xff +
+      (((int)data[6]) >> 16) & 0xff +
+      (((int)data[7]) >> 24) & 0xff;
+  }
+
+  protected static byte[] pack(int target, int inUse)
+  {
+    byte[] rval = new byte[8];
+    rval[0] = (byte)(target & 0xff);
+    rval[1] = (byte)((target >> 8) & 0xff);
+    rval[2] = (byte)((target >> 16) & 0xff);
+    rval[3] = (byte)((target >> 24) & 0xff);
+    rval[4] = (byte)(inUse & 0xff);
+    rval[5] = (byte)((inUse >> 8) & 0xff);
+    rval[6] = (byte)((inUse >> 16) & 0xff);
+    rval[7] = (byte)((inUse >> 24) & 0xff);
     return rval;
   }
   

Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java Sun Dec  8 17:55:11 2013
@@ -142,6 +142,7 @@ public class DBInterfaceHSQLDB extends D
   public void closeDatabase()
     throws ManifoldCFException
   {
+    //System.out.println("Close database called");
     if (!isRemote)
     {
       try

Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ILockManager.java Sun Dec  8 17:55:11 2013
@@ -54,31 +54,50 @@ public interface ILockManager
     IServiceCleanup cleanup)
     throws ManifoldCFException;
   
+  /** Register a service and begin service activity.
+  * This atomic operation creates a permanent registration entry for a service.
+  * If the permanent registration entry already exists, this method will not create it or
+  * treat it as an error.  This operation also enters the "active" zone for the service.  The "active" zone will remain in force until it is
+  * canceled, or until the process is interrupted.  Ideally, the corresponding endServiceActivity method will be
+  * called when the service shuts down.  Some ILockManager implementations require that this take place for
+  * proper management.
+  * If the transient registration already exists, it is treated as an error and an exception will be thrown.
+  * If registration will succeed, then this method may call an appropriate IServiceCleanup method to clean up either the
+  * current service, or all services on the cluster.
+  *@param serviceType is the type of service.
+  *@param serviceName is the name of the service to register.  If null is passed, a transient unique service name will be
+  *    created, and will be returned to the caller.
+  *@param initialData is the initial service data for this service.
+  *@param cleanup is called to clean up either the current service, or all services of this type, if no other active service exists.
+  *    May be null.  Local service cleanup is never called if the serviceName argument is null.
+  *@return the actual service name.
+  */
+  public String registerServiceBeginServiceActivity(String serviceType, String serviceName,
+    byte[] initialData, IServiceCleanup cleanup)
+    throws ManifoldCFException;
+
   /** Set service data for a service.
   *@param serviceType is the type of service.
   *@param serviceName is the name of the service.
-  *@param dataType is the type of data.
   *@param serviceData is the data to update to (may be null).
   * This updates the service's transient data (or deletes it).  If the service is not active, an exception is thrown.
   */
-  public void updateServiceData(String serviceType, String serviceName, String dataType, byte[] serviceData)
+  public void updateServiceData(String serviceType, String serviceName, byte[] serviceData)
     throws ManifoldCFException;
 
   /** Retrieve service data for a service.
   *@param serviceType is the type of service.
   *@param serviceName is the name of the service.
-  *@param dataType is the type of data.
   *@return the service's transient data.
   */
-  public byte[] retrieveServiceData(String serviceType, String serviceName, String dataType)
+  public byte[] retrieveServiceData(String serviceType, String serviceName)
     throws ManifoldCFException;
   
   /** Scan service data for a service type.  Only active service data will be considered.
   *@param serviceType is the type of service.
-  *@param dataType is the type of data.
   *@param dataAcceptor is the object that will be notified of each item of data for each service name found.
   */
-  public void scanServiceData(String serviceType, String dataType, IServiceDataAcceptor dataAcceptor)
+  public void scanServiceData(String serviceType, IServiceDataAcceptor dataAcceptor)
     throws ManifoldCFException;
 
   /** Count all active services of a given type.

Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/jdbcpool/ConnectionPoolManager.java Sun Dec  8 17:55:11 2013
@@ -68,6 +68,7 @@ public class ConnectionPoolManager
   
   public void shutdown()
   {
+    //System.out.println("JDBC POOL SHUTDOWN CALLED");
     shuttingDown.set(true);
     while (connectionCloserThread.isAlive())
     {

Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java Sun Dec  8 17:55:11 2013
@@ -89,13 +89,12 @@ public class BaseLockManager implements 
   protected final static String activePrefix = "_ACTIVE_";
   /** A data name prefix, followed by the service type, and then followed by "_" and the service name and "_" and the datatype */
   protected final static String serviceDataPrefix = "_SERVICEDATA_";
-  /** A data name prefix, followed by the service type, and then followed by "_" and the service name, finally by "_" and the instance number */
-  protected final static String serviceDataListPrefix = "_SERVICEDATALIST_";
   /** Anonymous service name prefix, to be followed by an integer */
   protected final static String anonymousServiceNamePrefix = "_ANON_";
   /** Anonymous global variable name prefix, to be followed by the service type */
   protected final static String anonymousServiceTypeCounter = "_SERVICECOUNTER_";
   
+  
   /** Register a service and begin service activity.
   * This atomic operation creates a permanent registration entry for a service.
   * If the permanent registration entry already exists, this method will not create it or
@@ -118,6 +117,32 @@ public class BaseLockManager implements 
     IServiceCleanup cleanup)
     throws ManifoldCFException
   {
+    return registerServiceBeginServiceActivity(serviceType, serviceName, null, cleanup);
+  }
+
+  /** Register a service and begin service activity.
+  * This atomic operation creates a permanent registration entry for a service.
+  * If the permanent registration entry already exists, this method will not create it or
+  * treat it as an error.  This operation also enters the "active" zone for the service.  The "active" zone will remain in force until it is
+  * canceled, or until the process is interrupted.  Ideally, the corresponding endServiceActivity method will be
+  * called when the service shuts down.  Some ILockManager implementations require that this take place for
+  * proper management.
+  * If the transient registration already exists, it is treated as an error and an exception will be thrown.
+  * If registration will succeed, then this method may call an appropriate IServiceCleanup method to clean up either the
+  * current service, or all services on the cluster.
+  *@param serviceType is the type of service.
+  *@param serviceName is the name of the service to register.  If null is passed, a transient unique service name will be
+  *    created, and will be returned to the caller.
+  *@param initialData is the initial service data for this service.
+  *@param cleanup is called to clean up either the current service, or all services of this type, if no other active service exists.
+  *    May be null.  Local service cleanup is never called if the serviceName argument is null.
+  *@return the actual service name.
+  */
+  @Override
+  public String registerServiceBeginServiceActivity(String serviceType, String serviceName,
+    byte[] initialData, IServiceCleanup cleanup)
+    throws ManifoldCFException
+  {
     String serviceTypeLockName = buildServiceTypeLockName(serviceType);
     enterWriteLock(serviceTypeLockName);
     try
@@ -213,6 +238,8 @@ public class BaseLockManager implements 
 
       // Last, set the appropriate active flag
       setGlobalFlag(serviceActiveFlag);
+      writeServiceData(serviceType, serviceName, initialData);
+
       return serviceName;
     }
     finally
@@ -224,12 +251,11 @@ public class BaseLockManager implements 
   /** Set service data for a service.
   *@param serviceType is the type of service.
   *@param serviceName is the name of the service.
-  *@param dataType is the type of data.
   *@param serviceData is the data to update to (may be null).
   * This updates the service's transient data (or deletes it).  If the service is not active, an exception is thrown.
   */
   @Override
-  public void updateServiceData(String serviceType, String serviceName, String dataType, byte[] serviceData)
+  public void updateServiceData(String serviceType, String serviceName, byte[] serviceData)
     throws ManifoldCFException
   {
     String serviceTypeLockName = buildServiceTypeLockName(serviceType);
@@ -239,23 +265,7 @@ public class BaseLockManager implements 
       String serviceActiveFlag = makeActiveServiceFlagName(serviceType, serviceName);
       if (!checkGlobalFlag(serviceActiveFlag))
         throw new ManifoldCFException("Service '"+serviceName+"' of type '"+serviceType+"' is not active");
-      // This implementation is pretty lame - need to replace it with something which doesn't degrade with the
-      // number of data types being used, since they'll be a data type for each connection name.
-      // MHL
-      int i = 0;
-      while (true)
-      {
-        String dataTypeCandidate = readDataType(serviceType, serviceName, i);
-        if (dataTypeCandidate == null)
-        {
-          writeDataType(serviceType, serviceName, i, dataType);
-          break;
-        }
-        if (dataTypeCandidate.equals(dataType))
-          break;
-        i++;
-      }
-      writeServiceData(serviceType, serviceName, dataType, serviceData);
+      writeServiceData(serviceType, serviceName, serviceData);
     }
     finally
     {
@@ -266,11 +276,10 @@ public class BaseLockManager implements 
   /** Retrieve service data for a service.
   *@param serviceType is the type of service.
   *@param serviceName is the name of the service.
-  *@param dataType is the type of data.
   *@return the service's transient data.
   */
   @Override
-  public byte[] retrieveServiceData(String serviceType, String serviceName, String dataType)
+  public byte[] retrieveServiceData(String serviceType, String serviceName)
     throws ManifoldCFException
   {
     String serviceTypeLockName = buildServiceTypeLockName(serviceType);
@@ -280,7 +289,7 @@ public class BaseLockManager implements 
       String serviceActiveFlag = makeActiveServiceFlagName(serviceType, serviceName);
       if (!checkGlobalFlag(serviceActiveFlag))
         return null;
-      byte[] rval = readServiceData(serviceType, serviceName, dataType);
+      byte[] rval = readServiceData(serviceType, serviceName);
       if (rval == null)
         rval = new byte[0];
       return rval;
@@ -297,7 +306,7 @@ public class BaseLockManager implements 
   *@param dataAcceptor is the object that will be notified of each item of data for each service name found.
   */
   @Override
-  public void scanServiceData(String serviceType, String dataType, IServiceDataAcceptor dataAcceptor)
+  public void scanServiceData(String serviceType, IServiceDataAcceptor dataAcceptor)
     throws ManifoldCFException
   {
     String serviceTypeLockName = buildServiceTypeLockName(serviceType);
@@ -313,7 +322,7 @@ public class BaseLockManager implements 
           break;
         if (checkGlobalFlag(makeActiveServiceFlagName(serviceType, x)))
         {
-          byte[] serviceData = readServiceData(serviceType, x, dataType);
+          byte[] serviceData = readServiceData(serviceType, x);
           if (dataAcceptor.acceptServiceData(x, serviceData))
             break;
         }
@@ -522,82 +531,27 @@ public class BaseLockManager implements 
     writeData(serviceCounterName,serviceCounterData);
   }
   
-  protected void writeServiceData(String serviceType, String serviceName, String dataType, byte[] serviceData)
+  protected void writeServiceData(String serviceType, String serviceName, byte[] serviceData)
     throws ManifoldCFException
   {
-    writeData(makeServiceDataName(serviceType, serviceName, dataType), serviceData);
+    writeData(makeServiceDataName(serviceType, serviceName), serviceData);
   }
   
-  protected byte[] readServiceData(String serviceType, String serviceName, String dataType)
+  protected byte[] readServiceData(String serviceType, String serviceName)
     throws ManifoldCFException
   {
-    return readData(makeServiceDataName(serviceType, serviceName, dataType));
+    return readData(makeServiceDataName(serviceType, serviceName));
   }
   
   protected void deleteServiceData(String serviceType, String serviceName)
     throws ManifoldCFException
   {
-    List<String> dataTypes = new ArrayList<String>();
-    int i = 0;
-    while (true)
-    {
-      String dataType = readDataType(serviceType, serviceName, i);
-      if (dataType == null)
-        break;
-      dataTypes.add(dataType);
-      i++;
-    }
-    for (String dataType : dataTypes)
-    {
-      writeServiceData(serviceType, serviceName, dataType, null);
-    }
-    while (i > 0)
-    {
-      i--;
-      writeDataType(serviceType, serviceName, i, null);
-    }
-  }
-  
-  protected String readDataType(String serviceType, String serviceName, int i)
-    throws ManifoldCFException
-  {
-    String listEntry = buildServiceDataListEntry(serviceType, serviceName, i);
-    byte[] data = readData(listEntry);
-    if (data == null)
-      return null;
-    try
-    {
-      return new String(data, "utf-8");
-    }
-    catch (UnsupportedEncodingException e)
-    {
-      throw new RuntimeException("utf-8 not supported");
-    }
-  }
-  
-  protected void writeDataType(String serviceType, String serviceName, int i, String dataType)
-    throws ManifoldCFException
-  {
-    String listEntry = buildServiceDataListEntry(serviceType, serviceName, i);
-    if (dataType == null)
-      writeData(listEntry, null);
-    else
-    {
-      try
-      {
-        byte[] data = dataType.getBytes("utf-8");
-        writeData(listEntry,data);
-      }
-      catch (UnsupportedEncodingException e)
-      {
-        throw new RuntimeException("utf-8 not supported");
-      }
-    }
+    writeServiceData(serviceType, serviceName, null);
   }
   
-  protected static String makeServiceDataName(String serviceType, String serviceName, String dataType)
+  protected static String makeServiceDataName(String serviceType, String serviceName)
   {
-    return serviceDataPrefix + serviceType + "_" + serviceName + "_" + dataType;
+    return serviceDataPrefix + serviceType + "_" + serviceName;
   }
   
   protected static String makeActiveServiceFlagName(String serviceType, String serviceName)
@@ -644,11 +598,6 @@ public class BaseLockManager implements 
     return serviceListPrefix + serviceType + "_" + i;
   }
 
-  protected static String buildServiceDataListEntry(String serviceType, String serviceName, int i)
-  {
-    return serviceDataListPrefix + serviceType + "_" + serviceName + "_" + i;
-  }
-  
   protected static String buildServiceTypeLockName(String serviceType)
   {
     return serviceTypeLockPrefix + serviceType;

Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockManager.java Sun Dec  8 17:55:11 2013
@@ -69,43 +69,66 @@ public class LockManager implements ILoc
     return lockManager.registerServiceBeginServiceActivity(serviceType, serviceName, cleanup);
   }
   
+  /** Register a service and begin service activity.
+  * This atomic operation creates a permanent registration entry for a service.
+  * If the permanent registration entry already exists, this method will not create it or
+  * treat it as an error.  This operation also enters the "active" zone for the service.  The "active" zone will remain in force until it is
+  * canceled, or until the process is interrupted.  Ideally, the corresponding endServiceActivity method will be
+  * called when the service shuts down.  Some ILockManager implementations require that this take place for
+  * proper management.
+  * If the transient registration already exists, it is treated as an error and an exception will be thrown.
+  * If registration will succeed, then this method may call an appropriate IServiceCleanup method to clean up either the
+  * current service, or all services on the cluster.
+  *@param serviceType is the type of service.
+  *@param serviceName is the name of the service to register.  If null is passed, a transient unique service name will be
+  *    created, and will be returned to the caller.
+  *@param initialData is the initial service data for this service.
+  *@param cleanup is called to clean up either the current service, or all services of this type, if no other active service exists.
+  *    May be null.  Local service cleanup is never called if the serviceName argument is null.
+  *@return the actual service name.
+  */
+  @Override
+  public String registerServiceBeginServiceActivity(String serviceType, String serviceName,
+    byte[] initialData, IServiceCleanup cleanup)
+    throws ManifoldCFException
+  {
+    return lockManager.registerServiceBeginServiceActivity(serviceType, serviceName, initialData, cleanup);
+  }
+
   /** Set service data for a service.
   *@param serviceType is the type of service.
   *@param serviceName is the name of the service.
-  *@param dataType is the type of data.
   *@param serviceData is the data to update to (may be null).
   * This updates the service's transient data (or deletes it).  If the service is not active, an exception is thrown.
   */
   @Override
-  public void updateServiceData(String serviceType, String serviceName, String dataType, byte[] serviceData)
+  public void updateServiceData(String serviceType, String serviceName, byte[] serviceData)
     throws ManifoldCFException
   {
-    lockManager.updateServiceData(serviceType, serviceName, dataType, serviceData);
+    lockManager.updateServiceData(serviceType, serviceName, serviceData);
   }
 
   /** Retrieve service data for a service.
   *@param serviceType is the type of service.
   *@param serviceName is the name of the service.
-  *@param dataType is the type of data.
   *@return the service's transient data.
   */
   @Override
-  public byte[] retrieveServiceData(String serviceType, String serviceName, String dataType)
+  public byte[] retrieveServiceData(String serviceType, String serviceName)
     throws ManifoldCFException
   {
-    return lockManager.retrieveServiceData(serviceType, serviceName, dataType);
+    return lockManager.retrieveServiceData(serviceType, serviceName);
   }
 
   /** Scan service data for a service type.  Only active service data will be considered.
   *@param serviceType is the type of service.
-  *@param dataType is the type of data.
   *@param dataAcceptor is the object that will be notified of each item of data for each service name found.
   */
   @Override
-  public void scanServiceData(String serviceType, String dataType, IServiceDataAcceptor dataAcceptor)
+  public void scanServiceData(String serviceType, IServiceDataAcceptor dataAcceptor)
     throws ManifoldCFException
   {
-    lockManager.scanServiceData(serviceType, dataType, dataAcceptor);
+    lockManager.scanServiceData(serviceType, dataAcceptor);
   }
 
   /** Clean up any inactive services found.

Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java Sun Dec  8 17:55:11 2013
@@ -106,16 +106,15 @@ public class ZooKeeperConnection
   *@param nodePath is the path of the node.
   *@return the data, if the node if exists, otherwise null.
   */
-  public byte[] getNodeData(String nodePath, String childName)
+  public byte[] getNodeData(String nodePath)
     throws ManifoldCFException, InterruptedException
   {
     try
     {
-      String combinedPath = nodePath + "/" + childName;
-      Stat s = zookeeper.exists(combinedPath,false);
+      Stat s = zookeeper.exists(nodePath,false);
       if (s == null)
         return null;
-      return zookeeper.getData(combinedPath,false,s);
+      return zookeeper.getData(nodePath,false,s);
     }
     catch (KeeperException e)
     {
@@ -125,39 +124,12 @@ public class ZooKeeperConnection
   
   /** Set node data.
   */
-  public void setNodeData(String nodePath, String childName, byte[] data)
+  public void setNodeData(String nodePath, byte[] data)
     throws ManifoldCFException, InterruptedException
   {
     try
     {
-      String combinedPath = nodePath + "/" + childName;
-      while (true)
-      {
-        try
-        {
-          zookeeper.setData(combinedPath, data, -1);
-          return;
-        }
-        catch (KeeperException.NoNodeException e1)
-        {
-          // Create parent unless it already exists
-          try
-          {
-            zookeeper.create(combinedPath, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
-            return;
-          }
-          catch (KeeperException.NoNodeException e)
-          {
-            try
-            {
-              zookeeper.create(nodePath, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-            }
-            catch (KeeperException.NodeExistsException e2)
-            {
-            }
-          }
-        }
-      }
+      zookeeper.setData(nodePath, data, -1);
     }
     catch (KeeperException e)
     {

Modified: manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java Sun Dec  8 17:55:11 2013
@@ -43,7 +43,6 @@ public class ZooKeeperLockManager extend
   private final static String SERVICETYPE_LOCK_PATH_PREFIX = "/org.apache.manifoldcf.servicelock-";
   private final static String SERVICETYPE_ACTIVE_PATH_PREFIX = "/org.apache.manifoldcf.serviceactive-";
   private final static String SERVICETYPE_REGISTER_PATH_PREFIX = "/org.apache.manifoldcf.service-";
-  private final static String SERVICETYPE_DATA_PATH_PREFIX = "/org.apache.manifoldcf.servicedata-";
   
   /** Anonymous service name prefix, to be followed by an integer */
   protected final static String anonymousServiceNamePrefix = "_ANON_";
@@ -117,6 +116,31 @@ public class ZooKeeperLockManager extend
     IServiceCleanup cleanup)
     throws ManifoldCFException
   {
+    return registerServiceBeginServiceActivity(serviceType, serviceName, null, cleanup);
+  }
+    
+  /** Register a service and begin service activity.
+  * This atomic operation creates a permanent registration entry for a service.
+  * If the permanent registration entry already exists, this method will not create it or
+  * treat it as an error.  This operation also enters the "active" zone for the service.  The "active" zone will remain in force until it is
+  * canceled, or until the process is interrupted.  Ideally, the corresponding endServiceActivity method will be
+  * called when the service shuts down.  Some ILockManager implementations require that this take place for
+  * proper management.
+  * If the transient registration already exists, it is treated as an error and an exception will be thrown.
+  * If registration will succeed, then this method may call an appropriate IServiceCleanup method to clean up either the
+  * current service, or all services on the cluster.
+  *@param serviceType is the type of service.
+  *@param serviceName is the name of the service to register.  If null is passed, a transient unique service name will be
+  *    created, and will be returned to the caller.
+  *@param initialData is the initial service data for this service.
+  *@param cleanup is called to clean up either the current service, or all services of this type, if no other active service exists.
+  *    May be null.  Local service cleanup is never called if the serviceName argument is null.
+  *@return the actual service name.
+  */
+  public String registerServiceBeginServiceActivity(String serviceType, String serviceName,
+    byte[] initialData, IServiceCleanup cleanup)
+    throws ManifoldCFException
+  {
     try
     {
       ZooKeeperConnection connection = pool.grab();
@@ -187,7 +211,7 @@ public class ZooKeeperLockManager extend
           }
           
           // Last, set the appropriate active flag
-          connection.createNode(activePath, null);
+          connection.createNode(activePath, initialData);
           return serviceName;
         }
         finally
@@ -209,12 +233,11 @@ public class ZooKeeperLockManager extend
   /** Set service data for a service.
   *@param serviceType is the type of service.
   *@param serviceName is the name of the service.
-  *@param dataType is the type of data.
   *@param serviceData is the data to update to (may be null).
   * This updates the service's transient data (or deletes it).  If the service is not active, an exception is thrown.
   */
   @Override
-  public void updateServiceData(String serviceType, String serviceName, String dataType, byte[] serviceData)
+  public void updateServiceData(String serviceType, String serviceName, byte[] serviceData)
     throws ManifoldCFException
   {
     try
@@ -225,8 +248,8 @@ public class ZooKeeperLockManager extend
         enterServiceRegistryWriteLock(connection, serviceType);
         try
         {
-          String dataRootPath = buildServiceTypeDataPath(serviceType, serviceName);
-          connection.setNodeData(dataRootPath, dataType, (serviceData==null)?new byte[0]:serviceData);
+          String activePath = buildServiceTypeActivePath(serviceType, serviceName);
+          connection.setNodeData(activePath, (serviceData==null)?new byte[0]:serviceData);
         }
         finally
         {
@@ -247,11 +270,10 @@ public class ZooKeeperLockManager extend
   /** Retrieve service data for a service.
   *@param serviceType is the type of service.
   *@param serviceName is the name of the service.
-  *@param dataType is the type of data.
   *@return the service's transient data.
   */
   @Override
-  public byte[] retrieveServiceData(String serviceType, String serviceName, String dataType)
+  public byte[] retrieveServiceData(String serviceType, String serviceName)
     throws ManifoldCFException
   {
     try
@@ -262,8 +284,8 @@ public class ZooKeeperLockManager extend
         enterServiceRegistryReadLock(connection, serviceType);
         try
         {
-          String dataRootPath = buildServiceTypeDataPath(serviceType, serviceName);
-          return connection.getNodeData(dataRootPath, dataType);
+          String activePath = buildServiceTypeActivePath(serviceType, serviceName);
+          return connection.getNodeData(activePath);
         }
         finally
         {
@@ -283,11 +305,10 @@ public class ZooKeeperLockManager extend
 
   /** Scan service data for a service type.  Only active service data will be considered.
   *@param serviceType is the type of service.
-  *@param dataType is the type of data.
   *@param dataAcceptor is the object that will be notified of each item of data for each service name found.
   */
   @Override
-  public void scanServiceData(String serviceType, String dataType, IServiceDataAcceptor dataAcceptor)
+  public void scanServiceData(String serviceType, IServiceDataAcceptor dataAcceptor)
     throws ManifoldCFException
   {
     try
@@ -302,9 +323,10 @@ public class ZooKeeperLockManager extend
           List<String> children = connection.getChildren(registrationNodePath);
           for (String registeredServiceName : children)
           {
-            if (connection.checkNodeExists(buildServiceTypeActivePath(serviceType, registeredServiceName)))
+            String activeNodePath = buildServiceTypeActivePath(serviceType, registeredServiceName);
+            if (connection.checkNodeExists(activeNodePath))
             {
-              byte[] serviceData = connection.getNodeData(buildServiceTypeDataPath(serviceType, registeredServiceName), dataType);
+              byte[] serviceData = connection.getNodeData(activeNodePath);
               if (dataAcceptor.acceptServiceData(registeredServiceName, serviceData))
                 break;
             }
@@ -451,7 +473,6 @@ public class ZooKeeperLockManager extend
         enterServiceRegistryWriteLock(connection, serviceType);
         try
         {
-          connection.deleteNodeChildren(buildServiceTypeDataPath(serviceType,serviceName));
           connection.deleteNode(buildServiceTypeActivePath(serviceType, serviceName));
         }
         finally
@@ -606,12 +627,6 @@ public class ZooKeeperLockManager extend
     return SERVICETYPE_REGISTER_PATH_PREFIX + serviceType;
   }
   
-  /** Build a zk path of a node to have child nodes with service data */
-  protected static String buildServiceTypeDataPath(String serviceType, String serviceName)
-  {
-    return SERVICETYPE_DATA_PATH_PREFIX + serviceType + "-" + serviceName;
-  }
-  
   // Shared configuration
 
   /** Get the current shared configuration.  This configuration is available in common among all nodes,

Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/IdleCleanupThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/IdleCleanupThread.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/IdleCleanupThread.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/IdleCleanupThread.java Sun Dec  8 17:55:11 2013
@@ -67,7 +67,7 @@ public class IdleCleanupThread extends T
           cacheManager.expireObjects(System.currentTimeMillis());
           
           // Sleep for the retry interval.
-          ManifoldCF.sleep(15000L);
+          ManifoldCF.sleep(5000L);
         }
         catch (ManifoldCFException e)
         {

Modified: manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java?rev=1549080&r1=1549079&r2=1549080&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java (original)
+++ manifoldcf/branches/CONNECTORS-781/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/IdleCleanupThread.java Sun Dec  8 17:55:11 2013
@@ -66,13 +66,11 @@ public class IdleCleanupThread extends T
         try
         {
           // Do the cleanup
-          System.out.println("Polling...");
           repositoryConnectorPool.pollAllConnectors();
-          System.out.println("...done");
           cacheManager.expireObjects(System.currentTimeMillis());
           
           // Sleep for the retry interval.
-          ManifoldCF.sleep(15000L);
+          ManifoldCF.sleep(5000L);
         }
         catch (ManifoldCFException e)
         {