jvm.entity
Class TCPIPWriteThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--jclass.SleepingThread
              |
              +--jvm.entity.TCPIPWriteThread

public class TCPIPWriteThread
extends SleepingThread

A thread that reads Messages from a SimpleQueue and writes them to a stream through a SmartObjectOutputStream AFTER timestamping them using a internal settable timer.

It blocks if the queue becomes empty and waits for some queue Messages to appear.

Written: Radu Sion
Version: 1.17x
Source: TCPIPWriteThread.java

Visit Smart Software 

See Also:
Message, SimpleQueue, FullException, EmptyException, TCPIPReadThread, SleepingThread

Field Summary
 Timer timestampBase
          This timer is used in timestamping the outgoing messages.
 
Fields inherited from class jclass.SleepingThread
DEFAULT_SLEEP
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TCPIPWriteThread(SmartObjectOutputStream os, SimpleQueue queue, int max_messages, long sleep, long timestart)
          Creates a new TCPIPWriteThread.
 
Method Summary
protected  void finalize()
           
 boolean getActive()
          Gets the thread's current status.
 void run()
           
 void setActive(boolean how)
nbsp;         Sets the thread's status.
 
Methods inherited from class jclass.SleepingThread
getSleep, mysleep, pause, pause, setSleep
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timestampBase

public Timer timestampBase
This timer is used in timestamping the outgoing messages. It gets initialized inside the constructor but may be reinitialized at any moment.
Constructor Detail

TCPIPWriteThread

public TCPIPWriteThread(SmartObjectOutputStream os,
                        SimpleQueue queue,
                        int max_messages,
                        long sleep,
                        long timestart)
Creates a new TCPIPWriteThread.
Parameters:
os - The SmartObjectOutputStream to which to write
queue - The SimpleQueue from which to read
max_messages - The maximum number of Messages to read (if -1 then reading infinitely)
timestart - The initialization value for the internal timer.
Method Detail

setActive

public void setActive(boolean how)
Sets the thread's status. If active it runs ok. If not active run exits gracefully, after finishing the last action it was involved in. It is NOT equal to stop() which breaks into the thread's actions and exits run rightaway.

getActive

public boolean getActive()
Gets the thread's current status.
See Also:
setActive(boolean)

run

public void run()
Overrides:
run in class java.lang.Thread

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object