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

Michael Wilde wilde at mcs.anl.gov
Sun Jul 27 11:40:28 CDT 2008


I wrote it but forgot to remove junk-notes before I committed.
I will do that.

I inserted the IP address stuff based on reading Ioan's standalone 
Falkon client code. I did the per-service Resource fix based on advice 
from Mihael.

- Mike

On 7/27/08 5:03 AM, Ben Clifford wrote:
> 
> did you really write this code or is it from somone else?
> 
> On Sat, 26 Jul 2008, noreply at www.ci.uchicago.edu wrote:
> 
>> 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();
>>      }
>>
>> _______________________________________________
>> Swift-commit mailing list
>> Swift-commit at ci.uchicago.edu
>> http://mail.ci.uchicago.edu/mailman/listinfo/swift-commit
>>
>>



More information about the Swift-commit mailing list