Package org.eclipse.net4j.signal
Class Signal
- java.lang.Object
-
- org.eclipse.net4j.signal.Signal
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
SignalActor,SignalReactor
public abstract class Signal extends java.lang.Object implements java.lang.RunnableRepresents a single communications use-case in the scope of asignal protocol.- Author:
- Eike Stepper
-
-
Field Summary
Fields Modifier and Type Field Description static longNO_TIMEOUT
-
Constructor Summary
Constructors Constructor Description Signal(SignalProtocol<?> protocol, short id)Signal(SignalProtocol<?> protocol, short id, java.lang.String name)Both implementation classes of a logical signal must have the same signalID.Signal(SignalProtocol<?> protocol, java.lang.Enum<?> literal)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancloseChannelAfterMe()protected booleancloseInputStreamAfterMe()protected booleancloseOutputStreamAfterMe()protected abstract voidexecute(BufferInputStream in, BufferOutputStream out)protected voidfinishInputStream(java.io.InputStream in)protected voidfinishOutputStream(java.io.OutputStream out)protected voidflush()protected java.lang.StringgetAdditionalInfo()protected BufferInputStreamgetBufferInputStream()protected BufferOutputStreamgetBufferOutputStream()intgetCorrelationID()protected java.io.InputStreamgetCurrentInputStream()protected java.io.OutputStreamgetCurrentOutputStream()shortgetID()Returns the short integer ID of this signal that is unique among all signals of the associatedprotocol.java.lang.StringgetName()SignalProtocol<?>getProtocol()voidrun()java.lang.StringtoString()protected java.io.InputStreamwrapInputStream(java.io.InputStream in)protected java.io.OutputStreamwrapOutputStream(java.io.OutputStream out)
-
-
-
Field Detail
-
NO_TIMEOUT
public static final long NO_TIMEOUT
- Since:
- 2.0
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Signal
public Signal(SignalProtocol<?> protocol, short id, java.lang.String name)
Both implementation classes of a logical signal must have the same signalID. The signalID of a user signals must be equal to or greater than zero.- Since:
- 2.0
-
Signal
public Signal(SignalProtocol<?> protocol, short id)
- Since:
- 2.0
- See Also:
Signal(SignalProtocol, short, String)
-
Signal
public Signal(SignalProtocol<?> protocol, java.lang.Enum<?> literal)
- Since:
- 2.0
- See Also:
Signal(SignalProtocol, short, String)
-
-
Method Detail
-
getProtocol
public SignalProtocol<?> getProtocol()
-
getID
public final short getID()
Returns the short integer ID of this signal that is unique among all signals of the associatedprotocol.- Since:
- 2.0
-
getName
public java.lang.String getName()
- Since:
- 2.0
-
getCorrelationID
public final int getCorrelationID()
- Since:
- 2.0
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Since:
- 2.0
-
getAdditionalInfo
protected java.lang.String getAdditionalInfo()
- Since:
- 4.5
-
run
public final void run()
- Specified by:
runin interfacejava.lang.Runnable
-
getBufferInputStream
protected final BufferInputStream getBufferInputStream()
-
getBufferOutputStream
protected final BufferOutputStream getBufferOutputStream()
-
flush
protected final void flush() throws java.io.IOException- Throws:
java.io.IOException- Since:
- 2.0
-
closeChannelAfterMe
protected boolean closeChannelAfterMe()
- Since:
- 4.4
-
closeInputStreamAfterMe
protected boolean closeInputStreamAfterMe()
- Since:
- 4.5
-
closeOutputStreamAfterMe
protected boolean closeOutputStreamAfterMe()
- Since:
- 4.5
-
getCurrentInputStream
protected java.io.InputStream getCurrentInputStream()
- Since:
- 2.0
-
getCurrentOutputStream
protected java.io.OutputStream getCurrentOutputStream()
- Since:
- 2.0
-
wrapInputStream
protected java.io.InputStream wrapInputStream(java.io.InputStream in) throws java.io.IOException- Throws:
java.io.IOException
-
wrapOutputStream
protected java.io.OutputStream wrapOutputStream(java.io.OutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
finishInputStream
protected void finishInputStream(java.io.InputStream in) throws java.io.IOException- Throws:
java.io.IOException
-
finishOutputStream
protected void finishOutputStream(java.io.OutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
execute
protected abstract void execute(BufferInputStream in, BufferOutputStream out) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-