
public class SignalProtocol<INFRA_STRUCTURE> extends Protocol<INFRA_STRUCTURE> implements ISignalProtocol<INFRA_STRUCTURE>
signal protocol.
On the receiver side(s) of protocol the
createSignalReactor() method has to be overridden to
create appropriate peer instances for incoming signals.
| Modifier and Type | Class and Description |
|---|---|
static class |
SignalProtocol.TimeoutChangedEvent
|
ILocationAware.LocationILifecycle.DeferrableActivation| Modifier and Type | Field and Description |
|---|---|
static short |
SIGNAL_MONITOR_CANCELED |
static short |
SIGNAL_MONITOR_PROGRESS |
static short |
SIGNAL_REMOTE_EXCEPTION |
static short |
SIGNAL_SET_TIMEOUT |
DEFAULT_TIMEOUT, NO_TIMEOUTUNSPECIFIED_VERSION| Constructor and Description |
|---|
SignalProtocol(String type) |
| Modifier and Type | Method and Description |
|---|---|
void |
addStreamWrapper(IStreamWrapper streamWrapper) |
void |
close() |
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 |
doBeforeDeactivate() |
protected void |
doDeactivate() |
IStreamWrapper |
getStreamWrapper() |
long |
getTimeout() |
void |
handleBuffer(IBuffer buffer)
Handles a given (incoming) buffer.
|
protected void |
handleChannelDeactivation() |
protected boolean |
isSendingTimeoutChanges()
Returns
true by default, override to change this behaviour. |
IChannel |
open(IConnector connector) |
protected SignalReactor |
provideSignalReactor(short signalID) |
void |
setStreamWrapper(IStreamWrapper streamWrapper) |
void |
setTimeout(long timeout)
Equivalent to calling SignalProtocol.setTimeout(timeout, false).
|
boolean |
setTimeout(long timeout,
boolean useOldTimeoutToSendNewOne)
Update the timeout used for signal end of stream waiting time.
|
String |
toString() |
boolean |
waitForSignals(long timeout) |
doBeforeActivate, getBufferProvider, getChannel, getExecutorService, getInfraStructure, getLocation, getType, getUserID, getVersion, isClient, isServer, setChannel, setExecutorService, setInfraStructure, setUserIDactivate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, dump, getLifecycleState, isActive, isDeferredActivationaddListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBufferProvider, getChannel, getExecutorService, getInfraStructure, getType, setChannel, setExecutorService, setInfraStructuregetUserIDgetLocation, isClient, isServeraddListener, getListeners, hasListeners, removeListenerpublic static final short SIGNAL_REMOTE_EXCEPTION
public static final short SIGNAL_MONITOR_CANCELED
public static final short SIGNAL_MONITOR_PROGRESS
public static final short SIGNAL_SET_TIMEOUT
public SignalProtocol(String type)
public long getTimeout()
getTimeout in interface ISignalProtocol<INFRA_STRUCTURE>public void setTimeout(long timeout)
setTimeout in interface ISignalProtocol<INFRA_STRUCTURE>public boolean setTimeout(long timeout,
boolean useOldTimeoutToSendNewOne)
timeout - the new timeoutuseOldTimeoutToSendNewOne - true to use the old timeout, false to use the new specified one to sent to server side the new specified timeoutpublic IStreamWrapper getStreamWrapper()
getStreamWrapper in interface ISignalProtocol<INFRA_STRUCTURE>public void setStreamWrapper(IStreamWrapper streamWrapper)
setStreamWrapper in interface ISignalProtocol<INFRA_STRUCTURE>public void addStreamWrapper(IStreamWrapper streamWrapper)
addStreamWrapper in interface ISignalProtocol<INFRA_STRUCTURE>public IChannel open(IConnector connector)
open in interface ISignalProtocol<INFRA_STRUCTURE>public void close()
close in interface ISignalProtocol<INFRA_STRUCTURE>public boolean waitForSignals(long timeout)
public void handleBuffer(IBuffer buffer)
handleBuffer in interface IBufferHandlerbuffer - The buffer to be handled and otionally released.protected void doBeforeDeactivate()
throws Exception
doBeforeDeactivate in class LifecycleExceptionprotected void doDeactivate()
throws Exception
doDeactivate in class Protocol<INFRA_STRUCTURE>Exceptionprotected void handleChannelDeactivation()
handleChannelDeactivation in class Protocol<INFRA_STRUCTURE>protected final SignalReactor provideSignalReactor(short signalID)
protected SignalReactor createSignalReactor(short signalID)
null if the signal ID is invalid/unknown
for this protocol.protected boolean isSendingTimeoutChanges()
true by default, override to change this behaviour.Copyright (c) 2011-2014 Eike Stepper (Berlin, Germany) and others.