swpchat.util
Class Waiter

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--swpchat.util.Waiter
All Implemented Interfaces:
java.lang.Runnable

public class Waiter
extends java.lang.Thread

This class is used for inter-thread-communication. (e.g. between MessageReceiver and ReceiverServerConnection)


Field Summary
private  boolean exitNow
           
private  java.lang.String result
           
private  boolean waiting
           
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ
 
Constructor Summary
Waiter()
          The constructor automagically starts the thread.
 
Method Summary
 void cont(java.lang.String message)
          Tell the Waiter to stop waiting and end the thread.
 void run()
          Waits until exitNow is set to true by waitForCont(), then the thread ends.
 java.lang.String waitForCont()
          Waits until someone calls cont(String) and returns the String passed to cont(String).
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

waiting

private boolean waiting

exitNow

private boolean exitNow

result

private java.lang.String result
Constructor Detail

Waiter

public Waiter()
The constructor automagically starts the thread.
Method Detail

waitForCont

public java.lang.String waitForCont()
Waits until someone calls cont(String) and returns the String passed to cont(String).

cont

public void cont(java.lang.String message)
Tell the Waiter to stop waiting and end the thread.
Parameters:
message - will be returned by waitForCont().

run

public void run()
Waits until exitNow is set to true by waitForCont(), then the thread ends.
Overrides:
run in class java.lang.Thread