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.Location
ILifecycle.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_TIMEOUT
UNSPECIFIED_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 |
doAfterActivate() |
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) |
String |
toString() |
boolean |
waitForSignals(long timeout) |
doBeforeActivate, getBufferProvider, getChannel, getExecutorService, getInfraStructure, getLocation, getType, getUserID, getVersion, isClient, isServer, setChannel, setExecutorService, setInfraStructure, setUserID
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, dump, getLifecycleState, isActive, isDeferredActivation
addListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBufferProvider, getChannel, getExecutorService, getInfraStructure, getType, setChannel, setExecutorService, setInfraStructure
getUserID
getLocation, isClient, isServer
addListener, getListeners, hasListeners, removeListener
public 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 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 IBufferHandler
buffer
- The buffer to be handled and otionally released.protected void doAfterActivate() throws Exception
doAfterActivate
in class Lifecycle
Exception
protected void doBeforeDeactivate() throws Exception
doBeforeDeactivate
in class Lifecycle
Exception
protected void doDeactivate() throws Exception
doDeactivate
in class Protocol<INFRA_STRUCTURE>
Exception
protected 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, 2012 Eike Stepper (Berlin, Germany) and others.