Chat
Class Receiver

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--Chat.Receiver
All Implemented Interfaces:
java.lang.Runnable

class Receiver
extends java.lang.Thread

A receiver, "server" thread. Listens for protocol messages and processes them sychronously, using Console and HostList objects.

See Also:
Sender, Console, HostList

Field Summary
private  Console console
          The link to common console.
private  HostList hostlist
          The link to common host list.
 
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
(package private) Receiver(Console console, HostList hostlist)
          Initializes the receiver thread with the link to console and host list.
 
Method Summary
(package private)  void process(java.io.BufferedReader in, java.io.PrintWriter out)
          Process incoming message.
 void run()
          Receiver thread's body.
 
Methods inherited from class java.lang.Thread
, activeCount, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, checkAccess, 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

console

private final Console console
The link to common console.

hostlist

private final HostList hostlist
The link to common host list.
Constructor Detail

Receiver

Receiver(Console console,
         HostList hostlist)
Initializes the receiver thread with the link to console and host list. Also starts the thread.
Parameters:
console - link to console.
hostlist - link to hostlist.
Method Detail

process

void process(java.io.BufferedReader in,
             java.io.PrintWriter out)
       throws java.io.IOException
Process incoming message.
Parameters:
in - input stream.
out - output stream.

run

public void run()
Receiver thread's body. Waits in the loop for either a connection or the change in listening port setup.
Overrides:
run in class java.lang.Thread