manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1550170 - in /manifoldcf/trunk: ./ framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler...
Date Wed, 11 Dec 2013 15:23:59 GMT
Author: kwright
Date: Wed Dec 11 15:23:59 2013
New Revision: 1550170

URL: http://svn.apache.org/r1550170
Log:
Fix for CONNECTORS-835.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/StufferThread.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1550170&r1=1550169&r2=1550170&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Wed Dec 11 15:23:59 2013
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 1.5-dev =====================
 
+CONNECTORS-835: Fix busted ZooKeeper implementation.
+(Karl Wright)
+
 CONNECTORS-833: Fix Null Pointer exception in LiveLink connector.
 (David Morana, Karl Wright)
 

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java?rev=1550170&r1=1550169&r2=1550170&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java
(original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/connectorpool/ConnectorPool.java
Wed Dec 11 15:23:59 2013
@@ -733,20 +733,20 @@ public abstract class ConnectorPool<T ex
   {
     if (data == null || data.length != 8)
       return 0;
-    return ((int)data[0]) & 0xff +
-      (((int)data[1]) << 8) & 0xff00 +
-      (((int)data[2]) << 16) & 0xff0000 +
-      (((int)data[3]) << 24) & 0xff000000;
+    return (((int)data[0]) & 0xff) +
+      ((((int)data[1]) << 8) & 0xff00) +
+      ((((int)data[2]) << 16) & 0xff0000) +
+      ((((int)data[3]) << 24) & 0xff000000);
   }
 
   protected static int unpackInUse(byte[] data)
   {
     if (data == null || data.length != 8)
       return 0;
-    return ((int)data[4]) & 0xff +
-      (((int)data[5]) << 8) & 0xff00 +
-      (((int)data[6]) << 16) & 0xff0000 +
-      (((int)data[7]) << 24) & 0xff000000;
+    return (((int)data[4]) & 0xff) +
+      ((((int)data[5]) << 8) & 0xff00) +
+      ((((int)data[6]) << 16) & 0xff0000) +
+      ((((int)data[7]) << 24) & 0xff000000);
   }
 
   protected static byte[] pack(int target, int inUse)

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java?rev=1550170&r1=1550169&r2=1550170&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java
(original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/BaseLockManager.java
Wed Dec 11 15:23:59 2013
@@ -512,10 +512,10 @@ public class BaseLockManager implements 
     byte[] serviceCounterData = readData(serviceCounterName);
     if (serviceCounterData == null || serviceCounterData.length != 4)
       return 0;
-    return ((int)serviceCounterData[0]) & 0xff +
-      (((int)serviceCounterData[1]) << 8) & 0xff00 +
-      (((int)serviceCounterData[2]) << 16) & 0xff0000 +
-      (((int)serviceCounterData[3]) << 24) & 0xff000000;
+    return (((int)serviceCounterData[0]) & 0xff) +
+      ((((int)serviceCounterData[1]) << 8) & 0xff00) +
+      ((((int)serviceCounterData[2]) << 16) & 0xff0000) +
+      ((((int)serviceCounterData[3]) << 24) & 0xff000000);
   }
   
   /** Write service counter.

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java?rev=1550170&r1=1550169&r2=1550170&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java
(original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperLockManager.java
Wed Dec 11 15:23:59 2013
@@ -587,13 +587,19 @@ public class ZooKeeperLockManager extend
     int rval;
     byte[] serviceCounterData = connection.readData(serviceCounterName);
     if (serviceCounterData == null || serviceCounterData.length != 4)
+    {
       rval = 0;
+      //System.out.println(" Null or bad data length for service counter '"+serviceCounterName+"'");
+    }
     else
-      rval = ((int)serviceCounterData[0]) & 0xff +
-        (((int)serviceCounterData[1]) << 8) & 0xff00 +
-        (((int)serviceCounterData[2]) << 16) & 0xff0000 +
-        (((int)serviceCounterData[3]) << 24) & 0xff000000;
-    System.out.println("Read service counter '"+serviceCounterName+"'; value = "+rval);
+    {
+      rval = (((int)serviceCounterData[0]) & 0xff) +
+        ((((int)serviceCounterData[1]) << 8) & 0xff00) +
+        ((((int)serviceCounterData[2]) << 16) & 0xff0000) +
+        ((((int)serviceCounterData[3]) << 24) & 0xff000000);
+      //System.out.println(" Read actual data from service counter '"+serviceCounterName+"':
"+java.util.Arrays.toString(serviceCounterData));
+    }
+    //System.out.println("Read service counter '"+serviceCounterName+"'; value = "+rval);
     return rval;
   }
   
@@ -608,7 +614,7 @@ public class ZooKeeperLockManager extend
     serviceCounterData[2] = (byte)((counter >> 16) & 0xff);
     serviceCounterData[3] = (byte)((counter >> 24) & 0xff);
     connection.writeData(serviceCounterName,serviceCounterData);
-    System.out.println("Wrote service counter '"+serviceCounterName+"'; value = "+counter);
+    //System.out.println("Wrote service counter '"+serviceCounterName+"'; value = "+counter+":
"+java.util.Arrays.toString(serviceCounterData));
   }
 
   /** Build a zk path for the lock for a specific service type.

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/StufferThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/StufferThread.java?rev=1550170&r1=1550169&r2=1550170&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/StufferThread.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/StufferThread.java
Wed Dec 11 15:23:59 2013
@@ -435,14 +435,14 @@ public class StufferThread extends Threa
     byte[] data = lockManager.readData(stufferThreadLastTimeDatumName);
     if (data == null || data.length != 8)
       return System.currentTimeMillis();
-    long value = ((long)data[0]) & 0xffL +
-      (((long)data[1]) << 8) & 0xff00L +
-      (((long)data[2]) << 16) & 0xff0000L +
-      (((long)data[3]) << 24) & 0xff000000L +
-      (((long)data[4]) << 32) & 0xff00000000L +
-      (((long)data[5]) << 40) & 0xff0000000000L +
-      (((long)data[6]) << 48) & 0xff000000000000L +
-      (((long)data[7]) << 56) & 0xff00000000000000L;
+    long value = (((long)data[0]) & 0xffL) +
+      ((((long)data[1]) << 8) & 0xff00L) +
+      ((((long)data[2]) << 16) & 0xff0000L) +
+      ((((long)data[3]) << 24) & 0xff000000L) +
+      ((((long)data[4]) << 32) & 0xff00000000L) +
+      ((((long)data[5]) << 40) & 0xff0000000000L) +
+      ((((long)data[6]) << 48) & 0xff000000000000L) +
+      ((((long)data[7]) << 56) & 0xff00000000000000L);
     return value;
   }
 



Mime
View raw message