[Swift-commit] r2149 - provider-deef/src/org/globus/cog/abstraction/impl/execution/deef

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Sat Jul 26 18:59:32 CDT 2008


Author: wilde
Date: 2008-07-26 18:59:31 -0500 (Sat, 26 Jul 2008)
New Revision: 2149

Modified:
   provider-deef/src/org/globus/cog/abstraction/impl/execution/deef/ResourcePool.java
Log:
Set Swift server IP from cog property for case of multiple interfaces, and create one resource pool per Falkon server

Modified: provider-deef/src/org/globus/cog/abstraction/impl/execution/deef/ResourcePool.java
===================================================================
--- provider-deef/src/org/globus/cog/abstraction/impl/execution/deef/ResourcePool.java	2008-07-25 00:00:44 UTC (rev 2148)
+++ provider-deef/src/org/globus/cog/abstraction/impl/execution/deef/ResourcePool.java	2008-07-26 23:59:31 UTC (rev 2149)
@@ -37,6 +37,9 @@
 import org.globus.cog.abstraction.impl.common.task.InvalidServiceContactException;
 import org.globus.cog.abstraction.impl.common.task.TaskSubmissionException;
 
+import org.globus.common.CoGProperties;
+
+
 public class ResourcePool {
     static Logger logger = Logger.getLogger(ResourcePool.class.getName());
     private EndpointReferenceType factoryEPR = null;
@@ -49,7 +52,8 @@
     private String server = "";
     private int num = 1;
     private static int crtResource = 0;
-    private static ResourcePool rp = null;
+    // private static ResourcePool rp = null;
+    private static HashMap rpmap = null;
     private Map tasks;
     private Notification userNot = null;
     private NotificationThread notThread;
@@ -60,8 +64,14 @@
     private UserJob job = null;
 
     public static synchronized ResourcePool instance(String server, int num) throws InvalidServiceContactException {
+        ResourcePool rp = null;
+
+        if( rpmap == null )
+            rpmap = new HashMap();
+        rp = (ResourcePool) rpmap.get(server);
 	if (rp == null) {
 	    rp = new ResourcePool();
+            rpmap.put(server, rp);
 	    rp.server = server;
 	    rp.num = num;
 	    rp.tasks = Collections.synchronizedMap(new HashMap());
@@ -166,13 +176,13 @@
          }
     }
 
-    public EndpointReferenceType getNextResource() {
+    public synchronized EndpointReferenceType getNextResource() {
 	int next = crtResource;
 	crtResource = (crtResource + 1) % num;
 	return (EndpointReferenceType) eprPool.get(next);
     }
 
-    public GPPortType getNextResourcePort() {
+    public synchronized GPPortType getNextResourcePort() {
 	int next = crtResource;
 	crtResource = (crtResource + 1) % num;
 	return (GPPortType) gptPool.get(next);
@@ -208,7 +218,7 @@
 	*/
     }
 
-    public static String getMachNamePort(Notification userNot){
+    public static String getMachNamePort__ORIG__(Notification userNot){
         String machName = "";
         //String machIP;
         try {
@@ -223,6 +233,38 @@
 	return machName;
     }
 
+/**** From Ioan:
+   public String getMachNamePort__IOANS_EMAIL__(int recvPort)
+   {
+       String machName = new String("localhost:"+recvPort);
+       try
+       {
+           String method = new String("overide");
+           if (NOTIFICATION_ENDPOINT == null)
+           {
+               NOTIFICATION_ENDPOINT = java.net.InetAddress.getLocalHost().getCanonicalHostName();
+               method = new String("automatic");
+           }
+           machName = NOTIFICATION_ENDPOINT +  ":" + recvPort;
+           System.out.println("Notification Endpoint (" + method + "): " + NOTIFICATION_ENDPOINT);
+       }
+       catch (Exception e)
+       {
+           System.out.println("WORKER: ERROR: java.net.InetAddress.getLocalHost().getHostName() failed " + e);
+           if (DEBUG) e.printStackTrace();
+       }
+       return machName;
+   }
+****/
+
+    public static String getMachNamePort(Notification userNot){
+        //String machIP = VDL2Config.getIP();
+	String machIP = CoGProperties.getDefault().getIPAddress();
+        String machNamePort = new String (machIP +  ":" + userNot.recvPort);
+        logger.debug("WORKER: Machine ID = " + machNamePort);
+	return machNamePort;
+    }
+
     public int getExecQueueSize() {
 	return execQueue.size();
     }




More information about the Swift-commit mailing list