ch.elca.el4j.services.tcpforwarder
Class UnidirectionalForwarderThread

java.lang.Object
  extended by java.lang.Thread
      extended by ch.elca.el4j.services.tcpforwarder.UnidirectionalForwarderThread
All Implemented Interfaces:
Runnable

public class UnidirectionalForwarderThread
extends Thread

Thread to forward got input to the output.

Author:
Martin Zeltner (MZE)
File-location:
UnidirectionalForwarderThread
Last check-in date:
2009-08-04 15:48:31 +0200 (Di, 04. Aug 2009) by swismer for revision 3884

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int BUFFER_SIZE
          Is the forwarder buffer size.
protected  boolean m_done
          Flag to mark if the forwarding is done.
protected  Socket m_inputSocket
          Is the input source.
protected  Link m_link
          Is the link this belongs to.
protected  Socket m_outputSocket
          Is the output drain.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
UnidirectionalForwarderThread(Link link, Socket inputSocket, Socket outputSocket)
          Constructor.
 
Method Summary
 void halt()
          Immediately stops the forwarder thread.
 boolean isDone()
           
 void run()
          Forwards data from input to output.
 void smoothHalt()
          Smmothly stops the forwarder thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BUFFER_SIZE

public static final int BUFFER_SIZE
Is the forwarder buffer size.

See Also:
Constant Field Values

m_link

protected final Link m_link
Is the link this belongs to.


m_inputSocket

protected final Socket m_inputSocket
Is the input source.


m_outputSocket

protected final Socket m_outputSocket
Is the output drain.


m_done

protected volatile boolean m_done
Flag to mark if the forwarding is done.

Constructor Detail

UnidirectionalForwarderThread

public UnidirectionalForwarderThread(Link link,
                                     Socket inputSocket,
                                     Socket outputSocket)
Constructor.

Parameters:
link - Is the link this belongs to.
inputSocket - Is the input source.
outputSocket - Is the output drain.
Method Detail

isDone

public boolean isDone()
Returns:
Return true if forwarding is done.

run

public void run()
Forwards data from input to output.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

smoothHalt

public void smoothHalt()
Smmothly stops the forwarder thread.


halt

public void halt()
Immediately stops the forwarder thread.



Copyright © 2005-2011 ELCA. All Rights Reserved.