org.globus.exec.service.test.throughput.util
Class StubCache

java.lang.Object
  extended by org.globus.exec.service.test.throughput.util.StubCache

public class StubCache
extends java.lang.Object

Cache for connections with duplicate entries. Caching strategy: LRU The key of a stub in the cache is a concatenation of - A string representation of the EPR of the service generated by EPRUtil.getEPRAsString(EndpointReferenceType) - The DN of the credential, if set in the security descriptor - The hashCode of the security descriptor


Field Summary
private  java.util.LinkedList<Connection> cache
           
private  int connectionTimeout
           
private static org.apache.commons.logging.Log log
           
private  int maxSize
           
private  java.util.concurrent.ScheduledExecutorService scheduler
           
private  java.util.concurrent.ScheduledFuture<?> sweeperHandle
           
 
Constructor Summary
StubCache(int connectionTimeout, int maxSize)
           
 
Method Summary
 void addStub(org.globus.axis.message.addressing.EndpointReferenceType epr, javax.xml.rpc.Stub stub)
          Add a stub to the cache
private  boolean connectionExpired(Connection connection)
           
private  java.lang.String createStubId(org.globus.axis.message.addressing.EndpointReferenceType epr, ClientSecurityDescriptor secDesc)
           
 javax.xml.rpc.Stub getStub(org.globus.axis.message.addressing.EndpointReferenceType epr, ClientSecurityDescriptor secDesc)
          Get a stub from the cache.
private  void removeExpiredStubs()
           
 void shutdown()
          Shutdown the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

scheduler

private java.util.concurrent.ScheduledExecutorService scheduler

sweeperHandle

private java.util.concurrent.ScheduledFuture<?> sweeperHandle

cache

private java.util.LinkedList<Connection> cache

connectionTimeout

private int connectionTimeout

maxSize

private int maxSize
Constructor Detail

StubCache

public StubCache(int connectionTimeout,
                 int maxSize)
Method Detail

getStub

public javax.xml.rpc.Stub getStub(org.globus.axis.message.addressing.EndpointReferenceType epr,
                                  ClientSecurityDescriptor secDesc)
Get a stub from the cache.

Returns:
stub that fits to epr and secDesc, or null if no suitable stub is found.

addStub

public void addStub(org.globus.axis.message.addressing.EndpointReferenceType epr,
                    javax.xml.rpc.Stub stub)
Add a stub to the cache


shutdown

public void shutdown()
Shutdown the cache.


createStubId

private java.lang.String createStubId(org.globus.axis.message.addressing.EndpointReferenceType epr,
                                      ClientSecurityDescriptor secDesc)
                               throws java.lang.Exception
Throws:
java.lang.Exception

removeExpiredStubs

private void removeExpiredStubs()

connectionExpired

private boolean connectionExpired(Connection connection)