org.jboss.remoting.detection
Class AbstractDetector

java.lang.Object
  extended byorg.jboss.remoting.detection.AbstractDetector
All Implemented Interfaces:
AbstractDetectorMBean, Detector, javax.management.MBeanRegistration
Direct Known Subclasses:
JNDIDetector, MulticastDetector

public abstract class AbstractDetector
extends Object
implements Detector, AbstractDetectorMBean

AbstractDetector

Version:
$Revision: 1.15 $
Author:
Jeff Haynie

Field Summary
protected static boolean DETECTOR_DEBUG
           
protected  org.jboss.logging.Logger log
           
protected  javax.management.MBeanServer mbeanserver
           
protected  javax.management.ObjectName objectName
           
protected  javax.management.ObjectName registryObjectName
           
 
Constructor Summary
AbstractDetector()
           
 
Method Summary
protected  boolean checkInvokerServer(Detection detection, ClassLoader cl)
           
protected  void detect(Detection detection)
          called when a remote detection from a peer is received by a detector
 Element getConfiguration()
          The getConfiguration method
protected  long getHeartbeatDelay()
          return the initial delay in milliseconds before the initial heartbeat is fired.
protected  long getHeartbeatPeriod()
          return the period in milliseconds between subsequent heartbeats.
protected  long getPingerDelay()
          return the delay in milliseconds between when the timer is created to when the first pinger thread runs.
protected  long getPingerPeriod()
          return the period in milliseconds between checking lost servers against the last detection timestamp.
protected abstract  void heartbeat()
          subclasses must implement to provide the specific heartbeat protocol for this server to send out to other servers on the network
protected  boolean isRemoteDetection(Detection detection)
           
 void postDeregister()
           
 void postRegister(Boolean aBoolean)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer mBeanServer, javax.management.ObjectName objectName)
           
 void setConfiguration(Element xml)
          set the configuration for the domains to be recognized by detector
 void start()
          called by MBeanServer to start the mbean lifecycle
protected  void startHeartbeat(long delay, long period)
          start heartbeating
protected  void startPinger(long delay, long period)
          start the pinger timer thread
 void stop()
          called by the MBeanServer to stop the mbean lifecycle
protected  void stopHeartbeat()
          stop heartbeating
protected  void stopPinger()
          stop the pinger timer thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DETECTOR_DEBUG

protected static final boolean DETECTOR_DEBUG

log

protected final org.jboss.logging.Logger log

mbeanserver

protected javax.management.MBeanServer mbeanserver

objectName

protected javax.management.ObjectName objectName

registryObjectName

protected javax.management.ObjectName registryObjectName
Constructor Detail

AbstractDetector

public AbstractDetector()
Method Detail

start

public void start()
           throws Exception
called by MBeanServer to start the mbean lifecycle

Specified by:
start in interface Detector
Throws:
Exception

getPingerDelay

protected long getPingerDelay()
return the delay in milliseconds between when the timer is created to when the first pinger thread runs. defaults to 5000

Returns:

getPingerPeriod

protected long getPingerPeriod()
return the period in milliseconds between checking lost servers against the last detection timestamp. defaults to 1500

Returns:

startPinger

protected void startPinger(long delay,
                           long period)
start the pinger timer thread

Parameters:
delay -
period -

stopPinger

protected void stopPinger()
stop the pinger timer thread


stop

public void stop()
          throws Exception
called by the MBeanServer to stop the mbean lifecycle

Specified by:
stop in interface Detector
Throws:
Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration

postRegister

public void postRegister(Boolean aBoolean)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
Exception

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer mBeanServer,
                                               javax.management.ObjectName objectName)
                                        throws Exception
Specified by:
preRegister in interface javax.management.MBeanRegistration
Throws:
Exception

setConfiguration

public void setConfiguration(Element xml)
                      throws Exception
set the configuration for the domains to be recognized by detector

Specified by:
setConfiguration in interface AbstractDetectorMBean
Parameters:
xml -
Throws:
Exception

getConfiguration

public Element getConfiguration()
The getConfiguration method

Specified by:
getConfiguration in interface AbstractDetectorMBean
Returns:
an Element value

startHeartbeat

protected void startHeartbeat(long delay,
                              long period)
start heartbeating

Parameters:
delay -
period -

stopHeartbeat

protected void stopHeartbeat()
stop heartbeating


getHeartbeatDelay

protected long getHeartbeatDelay()
return the initial delay in milliseconds before the initial heartbeat is fired. Defaults to 0

Returns:

getHeartbeatPeriod

protected long getHeartbeatPeriod()
return the period in milliseconds between subsequent heartbeats. Defaults to 1000

Returns:

heartbeat

protected abstract void heartbeat()
subclasses must implement to provide the specific heartbeat protocol for this server to send out to other servers on the network


detect

protected void detect(Detection detection)
called when a remote detection from a peer is received by a detector

Parameters:
detection -

isRemoteDetection

protected boolean isRemoteDetection(Detection detection)

checkInvokerServer

protected boolean checkInvokerServer(Detection detection,
                                     ClassLoader cl)


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.