org.eclipse.net4j.signal.heartbeat
Class HeartBeatProtocol

java.lang.Object
  extended by org.eclipse.net4j.util.event.Notifier
      extended by org.eclipse.net4j.util.lifecycle.Lifecycle
          extended by org.eclipse.spi.net4j.Protocol<INFRA_STRUCTURE>
              extended by org.eclipse.net4j.signal.SignalProtocol<Object>
                  extended by org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol
All Implemented Interfaces:
IBufferHandler, ILocationAware, IProtocol<Object>, IProtocol2<Object>, ISignalProtocol<Object>, INotifier, ILifecycle, ILifecycle.DeferrableActivation, IUserAware

public class HeartBeatProtocol
extends SignalProtocol<Object>

A signal protocol that keeps the connector of its channel open or provides early deactivation feedback by exchanging periodic heart beats.

Since:
2.0

Nested Class Summary
static class HeartBeatProtocol.Server
          The server-side implementation of a heart beat protocol.
 
Nested classes/interfaces inherited from class org.eclipse.net4j.signal.SignalProtocol
SignalProtocol.TimeoutChangedEvent
 
Nested classes/interfaces inherited from interface org.eclipse.net4j.ILocationAware
ILocationAware.Location
 
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
ILifecycle.DeferrableActivation
 
Field Summary
static String TYPE
           
 
Fields inherited from class org.eclipse.net4j.signal.SignalProtocol
SIGNAL_MONITOR_CANCELED, SIGNAL_MONITOR_PROGRESS, SIGNAL_REMOTE_EXCEPTION, SIGNAL_SET_TIMEOUT
 
Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
USE_LABEL
 
Fields inherited from interface org.eclipse.net4j.signal.ISignalProtocol
DEFAULT_TIMEOUT, NO_TIMEOUT
 
Fields inherited from interface org.eclipse.net4j.protocol.IProtocol2
UNSPECIFIED_VERSION
 
Constructor Summary
  HeartBeatProtocol(IConnector connector)
           
  HeartBeatProtocol(IConnector connector, IManagedContainer container)
           
  HeartBeatProtocol(IConnector connector, Timer timer)
           
protected HeartBeatProtocol(String type, IConnector connector, Timer timer)
           
 
Method Summary
protected  SignalReactor createSignalReactor(short signalID)
          Returns a new signal instance to serve the given signal ID or null if the signal ID is invalid/unknown for this protocol.
protected  void doDeactivate()
           
static Timer getDefaultTimer(IManagedContainer container)
           
 Timer getTimer()
           
protected  void handleTimeout(long untouched)
           
protected  void requestingStart(ExtendedDataOutputStream out, long rate)
           
 void start(long rate)
          Same as start(rate, 2 * rate).
 void start(long rate, long timeout)
           
 
Methods inherited from class org.eclipse.net4j.signal.SignalProtocol
addStreamWrapper, close, doAfterActivate, doBeforeDeactivate, getStreamWrapper, getTimeout, handleBuffer, handleChannelDeactivation, isSendingTimeoutChanges, open, provideSignalReactor, setStreamWrapper, setTimeout, toString, waitForSignals
 
Methods inherited from class org.eclipse.spi.net4j.Protocol
doBeforeActivate, getBufferProvider, getChannel, getExecutorService, getInfraStructure, getLocation, getType, getUserID, getVersion, isClient, isServer, setChannel, setExecutorService, setInfraStructure, setUserID
 
Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, dump, getLifecycleState, isActive, isDeferredActivation
 
Methods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.net4j.protocol.IProtocol
getBufferProvider, getChannel, getExecutorService, getInfraStructure, getType, setChannel, setExecutorService, setInfraStructure
 
Methods inherited from interface org.eclipse.net4j.util.security.IUserAware
getUserID
 
Methods inherited from interface org.eclipse.net4j.ILocationAware
getLocation, isClient, isServer
 
Methods inherited from interface org.eclipse.net4j.util.event.INotifier
addListener, getListeners, hasListeners, removeListener
 

Field Detail

TYPE

public static final String TYPE
See Also:
Constant Field Values
Constructor Detail

HeartBeatProtocol

protected HeartBeatProtocol(String type,
                            IConnector connector,
                            Timer timer)
Since:
4.0

HeartBeatProtocol

public HeartBeatProtocol(IConnector connector,
                         Timer timer)

HeartBeatProtocol

public HeartBeatProtocol(IConnector connector,
                         IManagedContainer container)
Since:
4.0

HeartBeatProtocol

public HeartBeatProtocol(IConnector connector)
Method Detail

getTimer

public Timer getTimer()

start

public void start(long rate)
Same as start(rate, 2 * rate).

See Also:
start(long, long)

start

public void start(long rate,
                  long timeout)

createSignalReactor

protected SignalReactor createSignalReactor(short signalID)
Description copied from class: SignalProtocol
Returns a new signal instance to serve the given signal ID or null if the signal ID is invalid/unknown for this protocol.

Overrides:
createSignalReactor in class SignalProtocol<Object>

handleTimeout

protected void handleTimeout(long untouched)

doDeactivate

protected void doDeactivate()
                     throws Exception
Overrides:
doDeactivate in class SignalProtocol<Object>
Throws:
Exception

requestingStart

protected void requestingStart(ExtendedDataOutputStream out,
                               long rate)
                        throws IOException
Throws:
IOException
Since:
4.0

getDefaultTimer

public static Timer getDefaultTimer(IManagedContainer container)


Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.