org.edg.info
Class InstanceBase

java.lang.Object
  extended byorg.edg.info.InstanceBase
Direct Known Subclasses:
ArchiverInstance, ConsumerInstance, DeclarableInstance, RegistryInstance, SchemaInstance

public abstract class InstanceBase
extends java.lang.Object

InstanceBase is an object that supports the corresponding APIBase. It holds state, and also offers methods which correspond to APIBase methods.


Field Summary
static long DEFAULT_TERMINATION_INTERVAL_MS
          Default termination interval in millis.
static long s_maxTerminationInterval
          The largest allowable termination interval.
static long s_minTerminationInterval
          The smallest allowable termination interval.
 
Method Summary
 boolean canDestroy()
          Determines if this instance can be destroyed (i.e.
 void disconnect()
          Closes the connection between this instance and any API object.
 long getLastRegistryUpdateTimeMillis()
           
 long getRegistryUpdateIntervalMillis()
           
 long getResourceId()
           
 void getStatus()
          returns status information for this instance
 long getTerminationInterval()
          Returns the terminationInterval in milliseconds.
 long getTerminationIntervalMillis()
           
 long getUserLastContactTimeMillis()
           
 boolean isDestroyed()
          Returns the value of the destroyed flag.
 boolean isTupleCheckingEnabled()
          Returns the tupleCheckingEnabled.
 void notifyRegistrationThread()
           
 void reconnect()
           
 void setCloseCalled(boolean closeCalled)
          Sets the value of the closeCalled flag.
 void setDestroyed(boolean destroyed)
          Sets the value of the destroyed flag.
 void setRegistrationThread(RegistrationThread registrationThread)
           
 void setTerminationInterval(long terminationIntervalMS)
          Sets the period of inactivity before the InstanceBase Object is unregistered.
 void showSignOfLife()
          Updates the last contact time for this Instance Object.
 void updateLastContactTime()
          Sets the last contact time to the current time.
 boolean updateRegistry(long currentTime, boolean isRegistryDown)
          Sends an update message to the Registry.
 boolean wasCloseCalled()
          Gets the value of the closeCalled flag.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TERMINATION_INTERVAL_MS

public static final long DEFAULT_TERMINATION_INTERVAL_MS
Default termination interval in millis.

See Also:
Constant Field Values

s_minTerminationInterval

public static long s_minTerminationInterval
The smallest allowable termination interval.


s_maxTerminationInterval

public static long s_maxTerminationInterval
The largest allowable termination interval.

Method Detail

wasCloseCalled

public boolean wasCloseCalled()
Gets the value of the closeCalled flag.

Returns:
true if close() has been called.

setCloseCalled

public void setCloseCalled(boolean closeCalled)
Sets the value of the closeCalled flag.

Parameters:
closeCalled - true if close() has been called.

setRegistrationThread

public void setRegistrationThread(RegistrationThread registrationThread)

updateRegistry

public boolean updateRegistry(long currentTime,
                              boolean isRegistryDown)
                       throws org.glite.rgma.system.RGMAException,
                              org.glite.rgma.system.RemoteException
Sends an update message to the Registry.

Parameters:
currentTime - Current time in millis.
isRegistryDown - Flag indicating if the Registry was down on the last call.
Returns:
Flag indicating if the Registry could not be contacted on this call.
Throws:
org.glite.rgma.system.RGMAException
org.glite.rgma.system.RemoteException

isDestroyed

public boolean isDestroyed()
Returns the value of the destroyed flag.

Returns:
true if object has been closed; false otherwise.

setDestroyed

public void setDestroyed(boolean destroyed)
Sets the value of the destroyed flag.

Parameters:
destroyed - true if object has been closed; false otherwise.

updateLastContactTime

public void updateLastContactTime()
Sets the last contact time to the current time.


canDestroy

public boolean canDestroy()
Determines if this instance can be destroyed (i.e. it has no remaining tuples).

Returns:
true if this instance can be destroyed

getStatus

public void getStatus()
               throws org.glite.rgma.system.RGMAException
returns status information for this instance

Returns:
RGMA ResultSet with the column "connectionId" containing an int.
Throws:
org.glite.rgma.system.RGMAException - if the instance has been closed.

setTerminationInterval

public void setTerminationInterval(long terminationIntervalMS)
                            throws org.glite.rgma.system.RGMAUserException,
                                   org.glite.rgma.system.RGMAInternalException
Sets the period of inactivity before the InstanceBase Object is unregistered.

Parameters:
terminationIntervalMS - The termination interval to be set (in ms).
Throws:
org.glite.rgma.system.RGMAException - if the termination interval exceeds the MAX_TERM_INTERVAL.
org.glite.rgma.system.RGMAUserException
org.glite.rgma.system.RGMAInternalException

getTerminationInterval

public long getTerminationInterval()
                            throws org.glite.rgma.system.RGMAException
Returns the terminationInterval in milliseconds.

Returns:
Termination interval in milliseconds.
Throws:
org.glite.rgma.system.RGMAException - DOCUMENT ME!

isTupleCheckingEnabled

public boolean isTupleCheckingEnabled()
                               throws org.glite.rgma.system.RGMAException
Returns the tupleCheckingEnabled.

Returns:
boolean
Throws:
org.glite.rgma.system.RGMAException - DOCUMENT ME!

disconnect

public void disconnect()
                throws org.glite.rgma.system.RGMAException
Closes the connection between this instance and any API object. Package-level methods (other than reconnect) will throw an exception if the instance is disconnected.

Throws:
org.glite.rgma.system.RGMAException - if this instance is closed or already disconnected.

reconnect

public void reconnect()
               throws org.glite.rgma.system.RGMAException
Throws:
org.glite.rgma.system.RGMAException

showSignOfLife

public void showSignOfLife()
                    throws org.glite.rgma.system.RGMAException
Updates the last contact time for this Instance Object. XXX Note the getInstance() of the TrackableServlet will already touch the last contact time of the Instance Object. But this approach is more clearly defined and is required by the ArchiverInstance to send a showSignOfLife() to both its Consumer and Producer. XXX-AC: throws RGMAException, as the ArchiverInstance's producer/consumer might be down.

Throws:
org.glite.rgma.system.RGMAException - DOCUMENT ME!

notifyRegistrationThread

public void notifyRegistrationThread()

getUserLastContactTimeMillis

public long getUserLastContactTimeMillis()
Returns:
The last user contact time in milliseconds.

getLastRegistryUpdateTimeMillis

public long getLastRegistryUpdateTimeMillis()
Returns:
Previous time the registry was updated in milliseconds.

getRegistryUpdateIntervalMillis

public long getRegistryUpdateIntervalMillis()
Returns:
Registry update interval in milliseconds.

getTerminationIntervalMillis

public long getTerminationIntervalMillis()
Returns:
The current termination interval in milliseconds.

getResourceId

public long getResourceId()
Returns:
The resource ID.