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.19 $
Author:
Jeff Haynie, Tom Elrod

Field Summary
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
 long getDefaultTimeDelay()
           
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.
 long getHeartbeatTimeDelay()
          The amount of time to wait between sending (and sometimes receiving) detection messages.
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 setDefaultTimeDelay(long defaultTimeDelay)
          The amount of time which can elapse without receiving a detection event before a server will be suspected as being dead and peroforming an explicit invocation on it to verify it is alive.
 void setHeartbeatTimeDelay(long heartbeatTimeDelay)
          The amount of time to wait between sending (and sometimes receiving) detection messages.
 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

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

setHeartbeatTimeDelay

public void setHeartbeatTimeDelay(long heartbeatTimeDelay)
                           throws org.jboss.system.ConfigurationException
The amount of time to wait between sending (and sometimes receiving) detection messages.

Specified by:
setHeartbeatTimeDelay in interface AbstractDetectorMBean
Parameters:
heartbeatTimeDelay -
Throws:
org.jboss.system.ConfigurationException

getHeartbeatTimeDelay

public long getHeartbeatTimeDelay()
The amount of time to wait between sending (and sometimes receiving) detection messages.

Specified by:
getHeartbeatTimeDelay in interface AbstractDetectorMBean
Returns:

setDefaultTimeDelay

public void setDefaultTimeDelay(long defaultTimeDelay)
                         throws org.jboss.system.ConfigurationException
The amount of time which can elapse without receiving a detection event before a server will be suspected as being dead and peroforming an explicit invocation on it to verify it is alive.

Specified by:
setDefaultTimeDelay in interface AbstractDetectorMBean
Parameters:
defaultTimeDelay - time in milliseconds
Throws:
org.jboss.system.ConfigurationException

getDefaultTimeDelay

public long getDefaultTimeDelay()
Specified by:
getDefaultTimeDelay in interface AbstractDetectorMBean
Returns:
The amount of time which can elapse without receiving a detection event before a server will be suspected as being dead and peroforming an explicit invocation on it to verify it is alive.

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 © 2004 JBoss Inc. All Rights Reserved.