OODT-896 fix inefficient constructors

Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/96c0ce65
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/96c0ce65
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/96c0ce65

Branch: refs/heads/master
Commit: 96c0ce65c233d632b2bc290b0a85a1bffa26368b
Parents: d5dfd9f
Author: Tom Barber <[email protected]>
Authored: Sat Oct 24 23:25:39 2015 +0100
Committer: Tom Barber <[email protected]>
Committed: Sat Oct 24 23:25:39 2015 +0100

----------------------------------------------------------------------
 .../cas/filemgr/util/XmlRpcStructFactory.java   |  4 +-
 .../resource/system/extern/XmlRpcBatchStub.java | 57 ++++++++++----------
 .../lifecycle/WorkflowLifecycleStage.java       |  2 +-
 3 files changed, 31 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/96c0ce65/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
----------------------------------------------------------------------
diff --git 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
index c5fddde..feab94c 100644
--- 
a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
+++ 
b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
@@ -17,7 +17,6 @@
 
 package org.apache.oodt.cas.filemgr.util;
 
-//OODT imports
 import org.apache.oodt.cas.filemgr.structs.BooleanQueryCriteria;
 import org.apache.oodt.cas.filemgr.structs.Element;
 import org.apache.oodt.cas.filemgr.structs.ExtractorSpec;
@@ -43,7 +42,6 @@ import java.util.List;
 import java.util.Properties;
 import java.util.Vector;
 
-//JDK imports
 
 /**
  * @author mattmann
@@ -103,7 +101,7 @@ public final class XmlRpcStructFactory {
         List<FileTransferStatus> statuses = new Vector<FileTransferStatus>();
 
         if (statusVector != null && statusVector.size() > 0) {
-            fore (Hashtable<String, Object> statusHash : statusVector) {
+            for (Hashtable<String, Object> statusHash : statusVector) {
                 FileTransferStatus status = 
getFileTransferStatusFromXmlRpc(statusHash);
                 statuses.add(status);
             }

http://git-wip-us.apache.org/repos/asf/oodt/blob/96c0ce65/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java
----------------------------------------------------------------------
diff --git 
a/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java
 
b/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java
index 529aaf0..ac734ab 100644
--- 
a/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java
+++ 
b/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java
@@ -42,11 +42,11 @@ import java.util.logging.Logger;
 /**
  * @author woollard
  * @version $Revision$
- * 
+ *
  * <p>
  * An XML RPC-based Batch Submission System.
  * </p>
- * 
+ *
  */
 public class XmlRpcBatchStub {
 
@@ -58,7 +58,7 @@ public class XmlRpcBatchStub {
 
     /* our log stream */
     private static Logger LOG = Logger.getLogger(XmlRpcBatchStub.class
-            .getName());
+        .getName());
 
     private static Map jobThreadMap = null;
 
@@ -73,7 +73,7 @@ public class XmlRpcBatchStub {
         jobThreadMap = new HashMap();
 
         LOG.log(Level.INFO, "XmlRpc Batch Stub started by "
-                + System.getProperty("user.name", "unknown"));
+                            + System.getProperty("user.name", "unknown"));
     }
 
     public boolean isAlive() {
@@ -81,37 +81,37 @@ public class XmlRpcBatchStub {
     }
 
     public boolean executeJob(Hashtable jobHash, Hashtable jobInput)
-            throws JobException {
+        throws JobException {
         return genericExecuteJob(jobHash, jobInput);
     }
 
     public boolean executeJob(Hashtable jobHash, Date jobInput)
-            throws JobException {
+        throws JobException {
         return genericExecuteJob(jobHash, jobInput);
     }
 
     public boolean executeJob(Hashtable jobHash, double jobInput)
-            throws JobException {
-        return genericExecuteJob(jobHash, jobInput);
+        throws JobException {
+        return genericExecuteJob(jobHash, new Double(jobInput));
     }
 
     public boolean executeJob(Hashtable jobHash, int jobInput)
-            throws JobException {
-        return genericExecuteJob(jobHash, jobInput);
+        throws JobException {
+        return genericExecuteJob(jobHash, new Integer(jobInput));
     }
 
     public boolean executeJob(Hashtable jobHash, boolean jobInput)
-            throws JobException {
-        return genericExecuteJob(jobHash, jobInput);
+        throws JobException {
+        return genericExecuteJob(jobHash, new Boolean(jobInput));
     }
 
     public boolean executeJob(Hashtable jobHash, Vector jobInput)
-            throws JobException {
+        throws JobException {
         return genericExecuteJob(jobHash, jobInput);
     }
 
     public boolean executeJob(Hashtable jobHash, byte[] jobInput)
-            throws JobException {
+        throws JobException {
         return genericExecuteJob(jobHash, jobInput);
     }
 
@@ -120,7 +120,7 @@ public class XmlRpcBatchStub {
         Thread jobThread = (Thread) jobThreadMap.get(job.getId());
         if (jobThread == null) {
             LOG.log(Level.WARNING, "Job: [" + job.getId()
-                    + "] not managed by this batch stub");
+                                   + "] not managed by this batch stub");
             return false;
         }
 
@@ -130,24 +130,22 @@ public class XmlRpcBatchStub {
     }
 
     private boolean genericExecuteJob(Hashtable jobHash, Object jobInput)
-            throws JobException {
-        JobInstance exec;
-        JobInput in;
+        throws JobException {
+        JobInstance exec = null;
+        JobInput in = null;
         try {
             Job job = XmlRpcStructFactory.getJobFromXmlRpc(jobHash);
 
             LOG.log(Level.INFO, "stub attempting to execute class: ["
-                    + job.getJobInstanceClassName() + "]");
+                                + job.getJobInstanceClassName() + "]");
 
             exec = GenericResourceManagerObjectFactory
-                    
.getJobInstanceFromClassName(job.getJobInstanceClassName());
+                .getJobInstanceFromClassName(job.getJobInstanceClassName());
             in = GenericResourceManagerObjectFactory
-                    .getJobInputFromClassName(job.getJobInputClassName());
+                .getJobInputFromClassName(job.getJobInputClassName());
 
             // load the input obj
-            if (in != null) {
-                in.read(jobInput);
-            }
+            in.read(jobInput);
 
             // create threaded job
             // so that it can be interrupted
@@ -161,7 +159,7 @@ public class XmlRpcBatchStub {
                 threadRunner.join();
             } catch (InterruptedException e) {
                 LOG.log(Level.INFO, "Current job: [" + job.getName()
-                        + "]: killed: exiting gracefully");
+                                    + "]: killed: exiting gracefully");
                 synchronized (jobThreadMap) {
                     Thread endThread = (Thread) jobThreadMap.get(job.getId());
                     if (endThread != null)
@@ -173,6 +171,7 @@ public class XmlRpcBatchStub {
             synchronized (jobThreadMap) {
                 Thread endThread = (Thread) jobThreadMap.get(job.getId());
                 if (endThread != null)
+                    endThread = null;
             }
 
             return runner.wasSuccessful();
@@ -197,6 +196,8 @@ public class XmlRpcBatchStub {
             System.exit(1);
         }
 
+        XmlRpcBatchStub stub = new XmlRpcBatchStub(portNum);
+
         for (;;)
             try {
                 Thread.currentThread().join();
@@ -211,7 +212,7 @@ public class XmlRpcBatchStub {
         private JobInstance job;
 
         private boolean successful;
-        
+
         public RunnableJob(JobInstance job, JobInput in) {
             this.job = job;
             this.in = in;
@@ -234,7 +235,7 @@ public class XmlRpcBatchStub {
         }
 
         public boolean wasSuccessful() {
-               return this.successful;
+            return this.successful;
         }
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oodt/blob/96c0ce65/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleStage.java
----------------------------------------------------------------------
diff --git 
a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleStage.java
 
b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleStage.java
index 56c4d2a..ad54eb2 100644
--- 
a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleStage.java
+++ 
b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleStage.java
@@ -116,7 +116,7 @@ public class WorkflowLifecycleStage {
    * @see java.lang.Object#hashCode()
    */
   public int hashCode() {
-    return this.name.hashCode() + Integer.valueOf(othis.order).hashCode();
+    return this.name.hashCode() + Integer.valueOf(this.order).hashCode();
   }
 
   /*

Reply via email to