Commits

dloy committed c2539d0

Test multithread

Comments (0)

Files changed (4)

fixity-storeload/src/main/java/org/cdlib/mrt/fixity/tools/Store2Fixity.java

                 handleException(prop);
             }
 
+            long itemKey = Store2FixityUtil.getItemKey(prop);
+            String itemKeyS = null;
+            if (itemKey <= 0) itemKeyS = null;
+            else itemKeyS = "" + itemKey;
+            System.out.println("****ITEMKEY=" + itemKey);
+
             for (String member: members) {
                 String memberContext = "|member=" + member + "|";
                 Properties contextProp = client.update(
                     linkS,
                     timeout,
                     retry,
+                    itemKeyS,
                     urlS,
                     null,
                     null,
                     linkS,
                     timeout,
                     retry,
+                    itemKeyS,
                     urlS,
                     null,
                     null,

fixity-storeload/src/main/java/org/cdlib/mrt/fixity/tools/Store2FixityListMulti.java

                 }
                 System.out.println("Line:" + line);
                 Store2FixityThread s2f = new Store2FixityThread(baseFile, baseURL, serverLink, cmdTypeS, line, logger);
-                threadPool.execute(s2f);
+
                 try {
-                    s2f.run();
+                    threadPool.execute(s2f);
                     
                 } catch (Exception ex) {
                     String exception = line + "::" + ex;
                         throw new TException.GENERAL_EXCEPTION(MESSAGE + "max exceptions");
                     }
                 }
-                
             }
 
+            threadPool.shutdown();
+            threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
+            log("************Termination of threads");
+
         } catch (TException fe) {
             throw fe;
 

fixity-storeload/src/main/java/org/cdlib/mrt/fixity/tools/Store2FixityThread.java

             if (isError(prop)) {
                 handleException(prop);
             }
+            long itemKey = Store2FixityUtil.getItemKey(prop);
+            String itemKeyS = null;
+            if (itemKey <= 0) itemKeyS = null;
+            else itemKeyS = "" + itemKey;
+            System.out.println("****ITEMKEY=" + itemKey);
 
             for (String member: members) {
                 String memberContext = "|member=" + member + "|";
                     linkS,
                     timeout,
                     retry,
+                    itemKeyS,
                     urlS,
                     null,
                     null,
                     linkS,
                     timeout,
                     retry,
+                    itemKeyS,
                     urlS,
                     null,
                     null,

fixity-storeload/src/main/java/org/cdlib/mrt/fixity/tools/Store2FixityUtil.java

+
+/*********************************************************************
+    Copyright 2003 Regents of the University of California
+    All rights reserved
+*********************************************************************/
+
+package org.cdlib.mrt.fixity.tools;
+
+import java.util.Properties;
+
+
+import org.cdlib.mrt.utility.StringUtil;
+
+
+/**
+ * Load manifest.
+ * @author  dloy
+ */
+
+public class Store2FixityUtil
+{
+    private static final String NAME = "Store2FixityUtil";
+    private static final String MESSAGE = NAME + ": ";
+    private static final boolean DEBUG = false;
+
+    public static long getItemKey(Properties prop)
+    {
+        String response = prop.getProperty("response.state");
+        long itemKey = 0;
+        if (StringUtil.isEmpty(response)) return 0;
+        String ikey = "<item:itemKey>";
+            //<item:itemKey>1</item:itemKey>
+        int startPos = response.indexOf(ikey);
+        if (startPos < 0) return 0;
+        String rest = response.substring(startPos + ikey.length());
+        if (DEBUG) System.out.println("****getItemKey1=" + rest);
+        startPos = rest.indexOf('<');
+        if (startPos < 0) return 0;
+        rest = rest.substring(0, startPos);
+        if (DEBUG) System.out.println("****getItemKey2=" + rest);
+        try {
+            itemKey = Long.parseLong(rest);
+        } catch (Exception ex) { return 0; }
+        
+        return itemKey;
+    }
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.