universal.communication
Class SocketReceiver

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--universal.communication.SocketReceiver
All Implemented Interfaces:
java.lang.Runnable

public class SocketReceiver
extends java.lang.Thread

Wait for packet to arrive to the socket. Then depending on the type of the message, it adds it to the vector AckBuffer, ReadBuffer or WriteBuffer if it is respectively an acknowledgement, read or write messages. If it is an Amalive message it inform the leader part of our algorithm that an AmAlive message has arrived.


Field Summary
(package private)  java.net.Socket clientSocket
           
(package private)  java.io.InputStream in
          The InputStream that arrive via the socket.
(package private)  universal.communication.Receiver rec
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
(package private) SocketReceiver(java.net.Socket clientSocket, universal.communication.Receiver rec)
           
 
Method Summary
 java.lang.Object receive()
           
 void run()
          Depending on the type of the message, it adds it to the vector AckBuffer, ReadBuffer or WriteBuffer if it is respectively an acknowledgement, read or write messages.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

clientSocket

java.net.Socket clientSocket

in

java.io.InputStream in
The InputStream that arrive via the socket.


rec

universal.communication.Receiver rec
Constructor Detail

SocketReceiver

SocketReceiver(java.net.Socket clientSocket,
               universal.communication.Receiver rec)
Method Detail

run

public void run()
Depending on the type of the message, it adds it to the vector AckBuffer, ReadBuffer or WriteBuffer if it is respectively an acknowledgement, read or write messages. If it is an Amalive message it inform the leader part of our algorithm that an AmAlive message has arrived.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

receive

public java.lang.Object receive()
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
Returns:
The message that has arrived as an Object
java.io.IOException
java.lang.ClassNotFoundException