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.InvalidSignalIDException |
static class |
SignalProtocol.TimeoutChangedEvent
|
ILocationAware.LocationILifecycle.DeferrableActivation| Modifier and Type | Field and Description |
|---|---|
static long |
COMPRESSED_STRINGS_ACKNOWLEDGE_TIMEOUT |
static short |
SIGNAL_ACKNOWLEDGE_COMPRESSED_STRINGS |
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(java.lang.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() |
protected StringCompressor |
getStringCompressor() |
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 behavior. |
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.
|
java.lang.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 long COMPRESSED_STRINGS_ACKNOWLEDGE_TIMEOUT
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 static final short SIGNAL_ACKNOWLEDGE_COMPRESSED_STRINGS
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 timeouttrue if the new specified timeout has correctly been sent
NOTE: this second parameter is useful mostly for test to be able to set a to small 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.protected void doBeforeDeactivate()
throws java.lang.Exception
doBeforeDeactivate in class Lifecyclejava.lang.Exceptionprotected void doDeactivate()
throws java.lang.Exception
doDeactivate in class Protocol<INFRA_STRUCTURE>java.lang.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 behavior.protected StringCompressor getStringCompressor()
Copyright (c) 2004-2019 Eike Stepper (Loehne, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html