edu.virginia.cs.mng.hypercast
Class ServerUdpReceiver

java.lang.Object
  |
  +--edu.virginia.cs.mng.hypercast.ServerUdpReceiver

class ServerUdpReceiver
extends java.lang.Object
implements java.lang.Runnable

The ServerUdpReceiver class starts a receiver thread to receive messages from a DatagramSocket.


Field Summary
(package private)  MessageBuffer adapterbuffer
          The buffer for received messages.
private  boolean died
          True if myThread has returned from run().
private  boolean dying
          True if the function die() has been called.
private  java.lang.Thread myThread
          The receiving thread.
(package private)  int[] offset
          The offset used in calls to I_AdapterCallBack.restoreMessage().
(package private)  UDP_ServerAdapter Parent
          The adapter.
(package private)  java.net.DatagramSocket ssocket
          The multicast socket.
private  boolean waiting
          True while myThread is waiting to receive.
private  java.lang.Object waitingGuard
          Guard used to protect waiting when it is changed.
 
Constructor Summary
ServerUdpReceiver(MessageBuffer bdbuffer, java.net.DatagramSocket ssock, UDP_ServerAdapter sadapter)
           
 
Method Summary
 void die()
          Causes myThread to halt eventually.
 boolean isDead()
          Returns true if myThread will never call an I_AdapterCallBack method again.
 void run()
          Start running of the Multicast thread.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

adapterbuffer

MessageBuffer adapterbuffer
The buffer for received messages.

ssocket

java.net.DatagramSocket ssocket
The multicast socket.

Parent

UDP_ServerAdapter Parent
The adapter.

offset

int[] offset
The offset used in calls to I_AdapterCallBack.restoreMessage().

myThread

private java.lang.Thread myThread
The receiving thread.

dying

private boolean dying
True if the function die() has been called.

died

private boolean died
True if myThread has returned from run().

waiting

private boolean waiting
True while myThread is waiting to receive.

waitingGuard

private java.lang.Object waitingGuard
Guard used to protect waiting when it is changed.
Constructor Detail

ServerUdpReceiver

public ServerUdpReceiver(MessageBuffer bdbuffer,
                         java.net.DatagramSocket ssock,
                         UDP_ServerAdapter sadapter)
Method Detail

run

public void run()
Start running of the Multicast thread. Reads messages from Multicast socket and save them to the BoundedBuffer.
Specified by:
run in interface java.lang.Runnable

die

public void die()
Causes myThread to halt eventually.

isDead

public boolean isDead()
Returns true if myThread will never call an I_AdapterCallBack method again.