[Swift-commit] Cog update

swift at ci.uchicago.edu swift at ci.uchicago.edu
Sat Apr 28 20:30:03 CDT 2012


------------------------------------------------------------------------
r3381 | hategan | 2012-04-28 20:29:23 -0500 (Sat, 28 Apr 2012) | 1 line

pre-compile regexp pattern and use string builder
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/SubmitJobHandler.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/SubmitJobHandler.java	(revision 3380)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/SubmitJobHandler.java	(working copy)
@@ -15,6 +15,7 @@
 import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.List;
+import java.util.regex.Pattern;
 import java.util.zip.InflaterInputStream;
 
 import org.apache.log4j.Logger;
@@ -151,6 +152,8 @@
         
         return task;
     }
+    
+    private static final Pattern COLON = Pattern.compile(":");
 
     protected void setServiceParams(ExecutionService s, String contact, 
                                     String provider, String jm) {
@@ -158,7 +161,7 @@
             jm = "fork";
         }
 
-        String[] els = jm.split(":");
+        String[] els = COLON.split(jm);
         if (els.length == 2 && "fork".equals(els[1])) {
             s.setProvider("local");
         }
@@ -259,7 +262,7 @@
         private void scan() throws IOException, ProtocolException {
             key = null;
             value = null;
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             int c = is.read();
             boolean nl = false;
             while (value == null) {
@@ -267,7 +270,7 @@
                     case '=': {
                         if (key == null) {
                             key = sb.toString();
-                            sb = new StringBuffer();
+                            sb = new StringBuilder();
                         }
                         else {
                             sb.append((char) c);



More information about the Swift-commit mailing list