|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmcast.MCastSocket
mcast.TOMCastSocket
public class TOMCastSocket
TOMCastSocket implements total ordering, on top of an MCastSocket, which provides (unordered) multicast.
Field Summary | |
---|---|
private int |
BUFFER_SIZE
A not-very-respected limit on the number of packets to be buffered. |
private int |
clock
Our Lamport clock. |
private boolean |
drained
Set to true once there are no more packets in the receive queue and there will never be any again. |
private java.util.concurrent.ArrayBlockingQueue<TOMCastPacket> |
inComingPktBuf
The ordered queue of packets to be given to the caller of receive(). |
private java.lang.Thread |
receiver
A TOMCastSocket uses a separate thread on the receive side. |
Fields inherited from class mcast.MCastSocket |
---|
CLOSED, CONNECTED, DRAINED, STARTING |
Constructor Summary | |
---|---|
TOMCastSocket()
Create a TOMCastSock socket at an ephemeral port. |
Method Summary | |
---|---|
private int |
incrementClock()
This is one of two routines that updates the clock in a thread safe way. |
TOMCastPacket |
receive()
Receive blocks if nothing is available right now. |
void |
run()
This is the receive thread loop, invoked when the thread is started. |
void |
send(TOMCastPacket pkt)
This is multicast send. |
private int |
updateClockWithMax(int otherVal)
This is one of two routines that updates the clock in a thread safe way. |
Methods inherited from class mcast.MCastSocket |
---|
getClientId, getMCastGroupSize, join, leave, send |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.Thread receiver
private java.util.concurrent.ArrayBlockingQueue<TOMCastPacket> inComingPktBuf
private final int BUFFER_SIZE
private boolean drained
private int clock
Constructor Detail |
---|
public TOMCastSocket() throws java.net.SocketException
java.net.SocketException
Method Detail |
---|
public TOMCastPacket receive()
receive
in class MCastSocket
public void send(TOMCastPacket pkt) throws java.io.IOException
java.io.IOException
private int updateClockWithMax(int otherVal)
otherVal
- Some value.
private int incrementClock()
public void run()
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |