Package org.eclipse.net4j.signal
Class SignalProtocol<INFRA_STRUCTURE>
- 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<INFRA_STRUCTURE>
 
 
 
 
- 
- All Implemented Interfaces:
- IBufferHandler,- ILocationAware,- IProtocol<INFRA_STRUCTURE>,- IProtocol2<INFRA_STRUCTURE>,- ISignalProtocol<INFRA_STRUCTURE>,- ISignalProtocol.WithSignalCounters<INFRA_STRUCTURE>,- 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
 - Direct Known Subclasses:
- AuthenticatingSignalProtocol,- HeartBeatProtocol,- HeartBeatProtocol.Server
 
 public class SignalProtocol<INFRA_STRUCTURE> extends Protocol<INFRA_STRUCTURE> implements ISignalProtocol.WithSignalCounters<INFRA_STRUCTURE> The default implementation of asignal protocol.On the receiver side(s)of protocol thecreateSignalReactor()method has to be overridden to create appropriate peer instances for incomingsignals.- Author:
- Eike Stepper
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSignalProtocol.InvalidSignalIDExceptionstatic classSignalProtocol.TimeoutChangedEvent- 
Nested classes/interfaces inherited from class org.eclipse.spi.net4j.ProtocolProtocol.InfraStructureChangedEvent
 - 
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycleorg.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation
 - 
Nested classes/interfaces inherited from interface org.eclipse.net4j.ILocationAwareILocationAware.Location
 - 
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifierorg.eclipse.net4j.util.event.INotifier.INotifier2
 - 
Nested classes/interfaces inherited from interface org.eclipse.net4j.signal.ISignalProtocolISignalProtocol.WithSignalCounters<INFRA_STRUCTURE>
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static longCOMPRESSED_STRINGS_ACKNOWLEDGE_TIMEOUTstatic shortSIGNAL_ACKNOWLEDGE_COMPRESSED_STRINGSstatic shortSIGNAL_MONITOR_CANCELEDstatic shortSIGNAL_MONITOR_PROGRESSstatic shortSIGNAL_REMOTE_EXCEPTIONstatic shortSIGNAL_SET_TIMEOUT- 
Fields inherited from interface org.eclipse.net4j.protocol.IProtocol2UNSPECIFIED_VERSION
 - 
Fields inherited from interface org.eclipse.net4j.signal.ISignalProtocolDEFAULT_TIMEOUT, NO_TIMEOUT
 
- 
 - 
Constructor SummaryConstructors Constructor Description SignalProtocol(java.lang.String type)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddStreamWrapper(org.eclipse.net4j.util.io.IStreamWrapper streamWrapper)voidclose()protected SignalReactorcreateSignalReactor(short signalID)Returns a new signal instance to serve the given signal ID ornullif the signal ID is invalid/unknown for this protocol.protected voiddoBeforeDeactivate()protected voiddoDeactivate()longgetReceivedSignals()longgetSentSignals()org.eclipse.net4j.util.io.IStreamWrappergetStreamWrapper()protected org.eclipse.net4j.util.io.StringCompressorgetStringCompressor()longgetTimeout()voidhandleBuffer(IBuffer buffer)Handles a given (incoming) buffer.protected voidhandleChannelDeactivation()protected booleanisSendingTimeoutChanges()Returnstrueby default, override to change this behavior.IChannelopen(IConnector connector)protected SignalReactorprovideSignalReactor(short signalID)voidsetStreamWrapper(org.eclipse.net4j.util.io.IStreamWrapper streamWrapper)voidsetTimeout(long timeout)Equivalent to calling SignalProtocol.setTimeout(timeout, false).booleansetTimeout(long timeout, boolean useOldTimeoutToSendNewOne)Update the timeout used for signal end of stream waiting time.java.lang.StringtoString()booleanwaitForSignals(long timeout)- 
Methods inherited from class org.eclipse.spi.net4j.ProtocoldoBeforeActivate, getBufferProvider, getChannel, getExecutorService, getInfraStructure, getLocation, getType, getUserID, getVersion, isClient, isServer, setChannel, setExecutorService, setInfraStructure, setUserID
 - 
Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycleactivate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, dump, getLifecycleState, isActive, isDeferredActivation
 - 
Methods inherited from class org.eclipse.net4j.util.event.NotifieraddListener, addUniqueListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListener
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.eclipse.net4j.ILocationAwaregetLocation, isClient, isServer
 - 
Methods inherited from interface org.eclipse.net4j.util.event.INotifieraddListener, getListeners, hasListeners, removeListener
 - 
Methods inherited from interface org.eclipse.net4j.protocol.IProtocolgetBufferProvider, getChannel, getExecutorService, getInfraStructure, getType, setChannel, setExecutorService, setInfraStructure
 
- 
 
- 
- 
- 
Field Detail- 
COMPRESSED_STRINGS_ACKNOWLEDGE_TIMEOUTpublic static final long COMPRESSED_STRINGS_ACKNOWLEDGE_TIMEOUT - Since:
- 4.7
 
 - 
SIGNAL_REMOTE_EXCEPTIONpublic static final short SIGNAL_REMOTE_EXCEPTION - Since:
- 2.0
- See Also:
- Constant Field Values
 
 - 
SIGNAL_MONITOR_CANCELEDpublic static final short SIGNAL_MONITOR_CANCELED - Since:
- 2.0
- See Also:
- Constant Field Values
 
 - 
SIGNAL_MONITOR_PROGRESSpublic static final short SIGNAL_MONITOR_PROGRESS - Since:
- 2.0
- See Also:
- Constant Field Values
 
 - 
SIGNAL_SET_TIMEOUTpublic static final short SIGNAL_SET_TIMEOUT - Since:
- 4.1
- See Also:
- Constant Field Values
 
 - 
SIGNAL_ACKNOWLEDGE_COMPRESSED_STRINGSpublic static final short SIGNAL_ACKNOWLEDGE_COMPRESSED_STRINGS - Since:
- 4.7
- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getTimeoutpublic long getTimeout() - Specified by:
- getTimeoutin interface- ISignalProtocol<INFRA_STRUCTURE>
- Since:
- 2.0
 
 - 
setTimeoutpublic void setTimeout(long timeout) Equivalent to calling SignalProtocol.setTimeout(timeout, false).- Specified by:
- setTimeoutin interface- ISignalProtocol<INFRA_STRUCTURE>
- Since:
- 2.0
 
 - 
setTimeoutpublic boolean setTimeout(long timeout, boolean useOldTimeoutToSendNewOne)Update the timeout used for signal end of stream waiting time.- Parameters:
- timeout- the new timeout
- useOldTimeoutToSendNewOne-- trueto use the old timeout,- falseto use the new specified one to sent to server side the new specified timeout
- Returns:
- trueif 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 timeout
- Since:
- 4.4
 
 - 
getStreamWrapperpublic org.eclipse.net4j.util.io.IStreamWrapper getStreamWrapper() - Specified by:
- getStreamWrapperin interface- ISignalProtocol<INFRA_STRUCTURE>
 
 - 
setStreamWrapperpublic void setStreamWrapper(org.eclipse.net4j.util.io.IStreamWrapper streamWrapper) - Specified by:
- setStreamWrapperin interface- ISignalProtocol<INFRA_STRUCTURE>
 
 - 
addStreamWrapperpublic void addStreamWrapper(org.eclipse.net4j.util.io.IStreamWrapper streamWrapper) - Specified by:
- addStreamWrapperin interface- ISignalProtocol<INFRA_STRUCTURE>
 
 - 
getSentSignalspublic long getSentSignals() - Specified by:
- getSentSignalsin interface- ISignalProtocol.WithSignalCounters<INFRA_STRUCTURE>
- Since:
- 4.13
 
 - 
getReceivedSignalspublic long getReceivedSignals() - Specified by:
- getReceivedSignalsin interface- ISignalProtocol.WithSignalCounters<INFRA_STRUCTURE>
 
 - 
openpublic IChannel open(IConnector connector) - Specified by:
- openin interface- ISignalProtocol<INFRA_STRUCTURE>
- Since:
- 2.0
 
 - 
closepublic void close() - Specified by:
- closein interface- ISignalProtocol<INFRA_STRUCTURE>
- Since:
- 2.0
 
 - 
waitForSignalspublic boolean waitForSignals(long timeout) 
 - 
handleBufferpublic void handleBuffer(IBuffer buffer) Handles a given (incoming) buffer. Creates a signal to act upon the given buffer or uses a previously created signal.- Specified by:
- handleBufferin interface- IBufferHandler
- Parameters:
- buffer- The buffer to be handled.
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- org.eclipse.net4j.util.lifecycle.Lifecycle
 
 - 
doBeforeDeactivateprotected void doBeforeDeactivate() throws java.lang.Exception- Overrides:
- doBeforeDeactivatein class- org.eclipse.net4j.util.lifecycle.Lifecycle
- Throws:
- java.lang.Exception
 
 - 
doDeactivateprotected void doDeactivate() throws java.lang.Exception- Overrides:
- doDeactivatein class- Protocol<INFRA_STRUCTURE>
- Throws:
- java.lang.Exception
 
 - 
handleChannelDeactivationprotected void handleChannelDeactivation() - Overrides:
- handleChannelDeactivationin class- Protocol<INFRA_STRUCTURE>
 
 - 
provideSignalReactorprotected final SignalReactor provideSignalReactor(short signalID) 
 - 
createSignalReactorprotected SignalReactor createSignalReactor(short signalID) Returns a new signal instance to serve the given signal ID ornullif the signal ID is invalid/unknown for this protocol.
 - 
isSendingTimeoutChangesprotected boolean isSendingTimeoutChanges() Returnstrueby default, override to change this behavior.- Since:
- 4.1
 
 - 
getStringCompressorprotected org.eclipse.net4j.util.io.StringCompressor getStringCompressor() - Since:
- 4.7
 
 
- 
 
-