mx4j.remote

Class AbstractHeartBeat

Implemented Interfaces:
HeartBeat, Runnable
Known Direct Subclasses:
HTTPHeartBeat, RMIHeartBeat

public abstract class AbstractHeartBeat
extends java.lang.Object
implements HeartBeat, Runnable

Base implementation for the HeartBeat interface.
Version:
$Revision: 1.4 $

Constructor Summary

AbstractHeartBeat(ConnectionNotificationEmitter emitter, Map environment)
Creates a new HeartBeat.

Method Summary

int
getMaxRetries()
long
getPulsePeriod()
protected abstract void
pulse()
Subclasses will implement this method using protocol specific connections.
void
run()
protected void
sendConnectionNotificationFailed()
Sends the connection failed notification using the emitter specified in AbstractHeartBeat
void
start()
void
stop()

Constructor Details

AbstractHeartBeat

protected AbstractHeartBeat(ConnectionNotificationEmitter emitter,
                            Map environment)
Creates a new HeartBeat.
Parameters:
emitter - The NotificationEmitter that sends connection failures notifications.
environment - The environment that may contain properties that specify heart beat's behavior

Method Details

getMaxRetries

public int getMaxRetries()
Specified by:
getMaxRetries in interface HeartBeat

getPulsePeriod

public long getPulsePeriod()
Specified by:
getPulsePeriod in interface HeartBeat

pulse

protected abstract void pulse()
            throws IOException
Subclasses will implement this method using protocol specific connections. Normally the method javax.management.MBeanServerConnection.getDefaultDomain is used to "ping" the server side.

run

public void run()

sendConnectionNotificationFailed

protected void sendConnectionNotificationFailed()
Sends the connection failed notification using the emitter specified in AbstractHeartBeat

start

public void start()
            throws IOException
Specified by:
start in interface HeartBeat

stop

public void stop()
            throws IOException
Specified by:
stop in interface HeartBeat

Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.