Package org.eclipse.net4j.signal.heartbeat

## Class HeartBeatProtocol

- java.lang.Object
- - org.eclipse.net4j.util.event.Notifier
  - - org.eclipse.net4j.util.lifecycle.Lifecycle
    - - org.eclipse.spi.net4j.Protocol<INFRA_STRUCTURE>
      - - org.eclipse.net4j.signal.SignalProtocol<java.lang.Object>
        - - org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol

- All Implemented Interfaces:
    `IBufferHandler`, `ILocationAware`, `IProtocol<java.lang.Object>`, `IProtocol2<java.lang.Object>`, `ISignalProtocol<java.lang.Object>`, `org.eclipse.net4j.util.concurrent.IExecutorServiceProvider`, `org.eclipse.net4j.util.event.INotifier`, `org.eclipse.net4j.util.event.INotifier.INotifier2`, `org.eclipse.net4j.util.lifecycle.IDeactivateable`, `org.eclipse.net4j.util.lifecycle.ILifecycle`, `org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation`, `org.eclipse.net4j.util.security.IUserAware`

      public class HeartBeatProtocol
      extends SignalProtocol<java.lang.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
  Author:
    Eike Stepper

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `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.InvalidSignalIDException, SignalProtocol.TimeoutChangedEvent`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

      `org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.ILocationAware

      `ILocationAware.Location`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier

      `org.eclipse.net4j.util.event.INotifier.INotifier2`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `TYPE` |

    - ### Fields inherited from class org.eclipse.net4j.signal.SignalProtocol

      `COMPRESSED_STRINGS_ACKNOWLEDGE_TIMEOUT, SIGNAL_ACKNOWLEDGE_COMPRESSED_STRINGS, 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.protocol.IProtocol2

      `UNSPECIFIED_VERSION`

    - ### Fields inherited from interface org.eclipse.net4j.signal.ISignalProtocol

      `DEFAULT_TIMEOUT, NO_TIMEOUT`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `HeartBeatProtocol​(java.lang.String type, IConnector connector, java.util.Timer timer)` |
    `` | `HeartBeatProtocol​(IConnector connector)` |
    `` | `HeartBeatProtocol​(IConnector connector, java.util.Timer timer)` |
    `` | `HeartBeatProtocol​(IConnector connector, org.eclipse.net4j.util.container.IManagedContainer container)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `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 java.util.Timer` | `getDefaultTimer​(org.eclipse.net4j.util.container.IManagedContainer container)` |
    `java.util.Timer` | `getTimer()` |
    `protected void` | `handleTimeout​(long untouched)` |
    `protected void` | `requestingStart​(org.eclipse.net4j.util.io.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, doBeforeDeactivate, getStreamWrapper, getStringCompressor, getTimeout, handleBuffer, handleChannelDeactivation, isSendingTimeoutChanges, open, provideSignalReactor, setStreamWrapper, setTimeout, 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, doAfterActivate, dump, getLifecycleState, isActive, isDeferredActivation`

    - ### Methods inherited from class org.eclipse.net4j.util.event.Notifier

      `addListener, addUniqueListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, 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.ILocationAware

      `getLocation, isClient, isServer`

    - ### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

      `addListener, getListeners, hasListeners, removeListener`

    - ### 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`

- - ### Field Detail

    - #### TYPE

          public static final java.lang.String TYPE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HeartBeatProtocol

          protected HeartBeatProtocol​(java.lang.String type,
                                      IConnector connector,
                                      java.util.Timer timer)

      Since:
        4.0

    - #### HeartBeatProtocol

          public HeartBeatProtocol​(IConnector connector,
                                   java.util.Timer timer)

    - #### HeartBeatProtocol

          public HeartBeatProtocol​(IConnector connector,
                                   org.eclipse.net4j.util.container.IManagedContainer container)

      Since:
        4.0

    - #### HeartBeatProtocol

          public HeartBeatProtocol​(IConnector connector)

  - ### Method Detail

    - #### getTimer

          public java.util.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<java.lang.Object>`

    - #### handleTimeout

          protected void handleTimeout​(long untouched)

    - #### doDeactivate

          protected void doDeactivate()
                               throws java.lang.Exception

      Overrides:
        `doDeactivate` in class `SignalProtocol<java.lang.Object>`
      Throws:
        `java.lang.Exception`

    - #### requestingStart

          protected void requestingStart​(org.eclipse.net4j.util.io.ExtendedDataOutputStream out,
                                         long rate)
                                  throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        4.0

    - #### getDefaultTimer

          public static java.util.Timer getDefaultTimer​(org.eclipse.net4j.util.container.IManagedContainer container)