org.eclipse.net4j.signal
Class Signal

java.lang.Object
  extended by org.eclipse.net4j.signal.Signal
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
SignalActor, SignalReactor

public abstract class Signal
extends Object
implements Runnable

Represents a single communications use-case in the scope of a signal protocol.


Field Summary
static long NO_TIMEOUT
           
 
Constructor Summary
Signal(SignalProtocol<?> protocol, Enum<?> literal)
           
Signal(SignalProtocol<?> protocol, short id)
           
Signal(SignalProtocol<?> protocol, short id, String name)
          Both implementation classes of a logical signal must have the same signalID.
 
Method Summary
protected abstract  void execute(BufferInputStream in, BufferOutputStream out)
           
protected  void finishInputStream(InputStream in)
           
protected  void finishOutputStream(OutputStream out)
           
protected  void flush()
           
protected  BufferInputStream getBufferInputStream()
           
protected  BufferOutputStream getBufferOutputStream()
           
 int getCorrelationID()
           
protected  InputStream getCurrentInputStream()
           
protected  OutputStream getCurrentOutputStream()
           
 short getID()
          Returns the short integer ID of this signal that is unique among all signals of the associated protocol.
 String getName()
           
 SignalProtocol<?> getProtocol()
           
 void run()
           
 String toString()
           
protected  InputStream wrapInputStream(InputStream in)
           
protected  OutputStream wrapOutputStream(OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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,
              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,
              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 associated protocol.

Since:
2.0

getName

public String getName()
Since:
2.0

getCorrelationID

public final int getCorrelationID()
Since:
2.0

toString

public String toString()
Overrides:
toString in class Object
Since:
2.0

run

public final void run()
Specified by:
run in interface Runnable

getBufferInputStream

protected final BufferInputStream getBufferInputStream()

getBufferOutputStream

protected final BufferOutputStream getBufferOutputStream()

flush

protected final void flush()
                    throws IOException
Throws:
IOException
Since:
2.0

getCurrentInputStream

protected InputStream getCurrentInputStream()
Since:
2.0

getCurrentOutputStream

protected OutputStream getCurrentOutputStream()
Since:
2.0

wrapInputStream

protected InputStream wrapInputStream(InputStream in)
                               throws IOException
Throws:
IOException

wrapOutputStream

protected OutputStream wrapOutputStream(OutputStream out)
                                 throws IOException
Throws:
IOException

finishInputStream

protected void finishInputStream(InputStream in)
                          throws IOException
Throws:
IOException

finishOutputStream

protected void finishOutputStream(OutputStream out)
                           throws IOException
Throws:
IOException

execute

protected abstract void execute(BufferInputStream in,
                                BufferOutputStream out)
                         throws Exception
Throws:
Exception


Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.