org.mbari.siam.registry
Class RegistryEntry

java.lang.Object
  extended by java.lang.Thread
      extended by org.mbari.siam.registry.RegistryEntry
All Implemented Interfaces:
java.lang.Runnable

public class RegistryEntry
extends java.lang.Thread

RegistryEntry encapsulates one registrant in the InstrumentRegistry. It includes the ability to receive callbacks when the Instrument that it represents posts new data.

Author:
Bob Herlien

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.util.Vector _dataListeners
           
protected  java.util.Vector _dataPackets
           
protected  long _isiId
           
protected static org.apache.log4j.Logger _log4j
           
protected  PacketParser _parser
           
protected  int _pktsDropped
           
protected  java.lang.String _regName
           
protected  boolean _running
           
protected  DeviceService _service
           
protected  java.lang.String _serviceName
           
protected static int LOG_MODULUS
           
protected static int MAX_QUEUE_SIZE
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RegistryEntry(DeviceService service, java.lang.String regName)
          Constructor
 
Method Summary
 void addDataListener(InstrumentDataListener listener)
          Add a InstrumentDataListener
 void callDataListeners(SensorDataPacket newData)
          Call back the InstrumentDataListeners
 void close()
          close() method forces the thread to exit
 boolean equals(long isiId)
          Object equals for InstrumentRegistry.find(long)
 boolean equals(java.lang.Object obj)
          Object equals for Vector.contains(), or if String, for InstrumentRegistry.find(String)
 boolean equals(java.lang.String lookupName)
          Object equals for InstrumentRegistry.find(String)
 long getId()
          Get the ISI ID for this entry's service
 DeviceService getService()
          Get the DeviceService represented by this entry
 int hashCode()
          hashCode() for Vector operations
 int numDataListeners()
          Return number of InstrumentDataLiseners
 java.lang.String registryName()
          Return registry name that will satisfy InstrumentRegistry.find(String)
 void removeDataListener(InstrumentDataListener listener)
          Remove a InstrumentDataListener
 void run()
          run() method for thread.
 java.lang.String serviceName()
          Return name of the DeviceService
 void setPacketParser(PacketParser parser)
          Set the PacketParser to use for callDataListeners()
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_log4j

protected static org.apache.log4j.Logger _log4j

MAX_QUEUE_SIZE

protected static final int MAX_QUEUE_SIZE
See Also:
Constant Field Values

LOG_MODULUS

protected static final int LOG_MODULUS
See Also:
Constant Field Values

_service

protected DeviceService _service

_regName

protected java.lang.String _regName

_isiId

protected long _isiId

_serviceName

protected java.lang.String _serviceName

_parser

protected PacketParser _parser

_dataListeners

protected java.util.Vector _dataListeners

_dataPackets

protected java.util.Vector _dataPackets

_running

protected boolean _running

_pktsDropped

protected int _pktsDropped
Constructor Detail

RegistryEntry

public RegistryEntry(DeviceService service,
                     java.lang.String regName)
Constructor

Method Detail

getService

public DeviceService getService()
Get the DeviceService represented by this entry


getId

public long getId()
Get the ISI ID for this entry's service

Overrides:
getId in class java.lang.Thread

addDataListener

public void addDataListener(InstrumentDataListener listener)
Add a InstrumentDataListener


removeDataListener

public void removeDataListener(InstrumentDataListener listener)
Remove a InstrumentDataListener


numDataListeners

public int numDataListeners()
Return number of InstrumentDataLiseners


setPacketParser

public void setPacketParser(PacketParser parser)
Set the PacketParser to use for callDataListeners()


callDataListeners

public void callDataListeners(SensorDataPacket newData)
Call back the InstrumentDataListeners


run

public void run()
run() method for thread. This thread actually calls the InstrumentDataListeners when new data arrives.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

close

public void close()
close() method forces the thread to exit


equals

public boolean equals(java.lang.Object obj)
Object equals for Vector.contains(), or if String, for InstrumentRegistry.find(String)

Overrides:
equals in class java.lang.Object

equals

public boolean equals(java.lang.String lookupName)
Object equals for InstrumentRegistry.find(String)


equals

public boolean equals(long isiId)
Object equals for InstrumentRegistry.find(long)


hashCode

public int hashCode()
hashCode() for Vector operations

Overrides:
hashCode in class java.lang.Object

registryName

public java.lang.String registryName()
Return registry name that will satisfy InstrumentRegistry.find(String)


serviceName

public java.lang.String serviceName()
Return name of the DeviceService


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Thread


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.