org.edg.info
Class OneTimeConsumerInstance

java.lang.Object
  extended byorg.edg.info.InstanceBase
      extended byorg.edg.info.ConsumerInstance
          extended byorg.edg.info.OneTimeConsumerInstance

public class OneTimeConsumerInstance
extends ConsumerInstance

OneTimeConsumerInstances only ever need to contact one publisher in order to answer a query. The registry will return a list of alternative publishers that the OTCI can use, and the instance will try to identify the one that is "closest". If it fails to contact the closest publisher when the query is run, then the next closest will be used.


Field Summary
 
Fields inherited from class org.edg.info.InstanceBase
DEFAULT_TERMINATION_INTERVAL_MS, s_maxTerminationInterval, s_minTerminationInterval
 
Constructor Summary
OneTimeConsumerInstance(java.lang.String selectStmt, java.net.URL servletURL, int connectionId, long terminationInterval, int cFlags, StreamingServer streamingServer, TimeoutThread timeoutThread, org.glite.rgma.services.config.ConsumerConfig consumerConfig)
          Creates a new OneTimeConsumerInstance object.
 
Method Summary
 void destroy()
          XXX-AC: note, this is called from a syncrhonized block in the instanceTracker.
 void flushQueue(java.lang.String queueName, java.lang.String host)
           
 org.glite.rgma.system.ProducerTableEntryList getProducerTableEntryList()
           
 void incCompletedExecutes()
          Increments the number of completed executes.
 boolean isExecuting()
          Returns the current status of the executing threads.
 void setProducerConnections(java.util.Vector servletConnections)
          Sets the list of producer connections for this Consumer to contact and sets isGlobalQuery to false.
 
Methods inherited from class org.edg.info.ConsumerInstance
abort, canPop, count, getCurrentMessageInFastQueue, getCurrentMessageInSlowQueue, getLastPopTimeMillis, getMessagesInFastQueue, getMessagesInSlowQueue, getNumTuplesInStore, getQuery, getQueryProperties, hasAborted, pop, pop, start, start
 
Methods inherited from class org.edg.info.InstanceBase
canDestroy, disconnect, getLastRegistryUpdateTimeMillis, getRegistryUpdateIntervalMillis, getResourceId, getStatus, getTerminationInterval, getTerminationIntervalMillis, getUserLastContactTimeMillis, isDestroyed, isTupleCheckingEnabled, notifyRegistrationThread, reconnect, setCloseCalled, setDestroyed, setRegistrationThread, setTerminationInterval, showSignOfLife, updateLastContactTime, updateRegistry, wasCloseCalled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneTimeConsumerInstance

public OneTimeConsumerInstance(java.lang.String selectStmt,
                               java.net.URL servletURL,
                               int connectionId,
                               long terminationInterval,
                               int cFlags,
                               StreamingServer streamingServer,
                               TimeoutThread timeoutThread,
                               org.glite.rgma.services.config.ConsumerConfig consumerConfig)
                        throws org.glite.rgma.system.RGMAInternalException,
                               org.glite.rgma.system.RGMAUserException
Creates a new OneTimeConsumerInstance object.

Parameters:
selectStmt - SQL SELECT query.
servletURL - Consumer URL.
connectionId - Consumer ID.
terminationInterval - Termination interval (in ms).
cFlags - Query type flags.
streamingServer - Reference to StreamingServer.
timeoutThread - Reference to TimeoutThread.
consumerConfig - Consumer static configuration.
Throws:
org.glite.rgma.system.RGMAException
org.glite.rgma.system.RGMAInternalException
org.glite.rgma.system.RGMAUserException
Method Detail

isExecuting

public boolean isExecuting()
                    throws org.glite.rgma.system.RGMAUserException
Returns the current status of the executing threads.

Specified by:
isExecuting in class ConsumerInstance
Returns:
boolean true if any threads are still executing a query, false otherwise.
Throws:
org.glite.rgma.system.RGMAException - if the API has been closed or is disconnected.
org.glite.rgma.system.RGMAUserException

incCompletedExecutes

public void incCompletedExecutes()
Increments the number of completed executes. When this equals the total number of producers that were contacted, the query has finished executing.

Overrides:
incCompletedExecutes in class ConsumerInstance

flushQueue

public void flushQueue(java.lang.String queueName,
                       java.lang.String host)
Specified by:
flushQueue in class ConsumerInstance
Parameters:
queueName -
host -

destroy

public void destroy()
Description copied from class: ConsumerInstance
XXX-AC: note, this is called from a syncrhonized block in the instanceTracker.

Overrides:
destroy in class ConsumerInstance
See Also:
org.edg.info.InstanceBase#destroy().

setProducerConnections

public void setProducerConnections(java.util.Vector servletConnections)
Description copied from class: ConsumerInstance
Sets the list of producer connections for this Consumer to contact and sets isGlobalQuery to false.

Specified by:
setProducerConnections in class ConsumerInstance
Parameters:
servletConnections - Vector of ServletConnection objects.

getProducerTableEntryList

public org.glite.rgma.system.ProducerTableEntryList getProducerTableEntryList()
Overrides:
getProducerTableEntryList in class ConsumerInstance
Returns:
A list of producers the consumer is currently using.