org.edg.info
Class InstanceTracker

java.lang.Object
  extended byorg.edg.info.InstanceTracker

public class InstanceTracker
extends java.lang.Object

InstanceTracker is used to store and track InstanceBase objects.


Constructor Summary
InstanceTracker(java.lang.String connectionIdFileName)
          Creates a new InstanceTracker Object.
 
Method Summary
 void add(int connectionId, InstanceBase instance)
          Adds a new InstanceBase to the tracker.
 void forceRemoveAll()
          Iterate through tracker and call remove(id) on all instances.
 InstanceBase get(int id)
          Retreives an InstanceBase from the tracker.
 java.lang.Object[] getInstances()
           
 java.lang.String getState()
          Attempts to build status information for each Object stored within the instance tracker.
 int nextId()
          Returns the next connection id.
 void remove(int id)
          Closes an InstanceBase and removes it from the tracker.
 java.util.Collection values()
          Returns the entire collection of instances.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceTracker

public InstanceTracker(java.lang.String connectionIdFileName)
Creates a new InstanceTracker Object.

Parameters:
connectionIdFileName - Name of connectionId file.
Method Detail

getState

public java.lang.String getState()
                          throws org.glite.rgma.system.RGMAException
Attempts to build status information for each Object stored within the instance tracker.

Returns:
Throws:
org.glite.rgma.system.RGMAException

add

public void add(int connectionId,
                InstanceBase instance)
Adds a new InstanceBase to the tracker. This is a replacement to the old method add() (without the connectionId defined as a parameter). This reduces the amount of locking required. The downside is, some connectionIds may not be used (if an RGMAException is thrown during object creation) which isn't too bad.

Parameters:
connectionId - the connection Id, used as a key.
instance - the instance object to store.

get

public InstanceBase get(int id)
                 throws org.glite.rgma.system.UnknownResourceException
Retreives an InstanceBase from the tracker.

Parameters:
id - identifies which instance to return.
Returns:
the identified InstanceBase.
Throws:
org.glite.rgma.system.RGMAException - if the instance is null or has been closed.
org.glite.rgma.system.UnknownResourceException

nextId

public int nextId()
Returns the next connection id.

Returns:
the next id to be assigned.

remove

public void remove(int id)
            throws org.glite.rgma.system.UnknownResourceException
Closes an InstanceBase and removes it from the tracker.

Parameters:
id - identifies the InstanceBase.
Throws:
org.glite.rgma.system.UnknownResourceException - If the resource/instance does not exist in the tracker.

forceRemoveAll

public void forceRemoveAll()
Iterate through tracker and call remove(id) on all instances.


values

public java.util.Collection values()
Returns the entire collection of instances.

Returns:
the Collection of instances.

getInstances

public java.lang.Object[] getInstances()
Returns:
Returns a copy of all resources currently stored by the tracker.