Class Player
Class Player
java.lang.Object
|
+----Player
- class Player
- extends Object
A class wrapping a whole communication endpoint including In/Out queues etc.
There are the in/out queues, and two threads that
take care of the client's Message queues.
Written: Radu Sion
Version: 0.28
Source: Player.java
- See Also:
- SimpleQueue, TCPIPReadThread, TCPIPWriteThread, Message, RoundRobinServerThread
-
Group
-
-
InMessageQueue
-
-
Number
-
-
OutMessageQueue
-
-
ReadThread
-
-
socket
-
-
WriteThread
-
-
Player(Socket, int, int, int, int, int, int)
- Creates a new Player object.
-
down()
- Stops the threads of this player and cleans up.
-
getGroup()
- Gets the group number of the client.
-
setExitIfFullQueues(boolean, boolean)
- Sets the behaviour of this player.
-
setGroup(int)
- Sets the group number of the client.
-
testOk()
- Tests if this player is ok, including threads etc.
socket
public Socket socket
Number
public int Number
Group
public int Group
ReadThread
public TCPIPReadThread ReadThread
WriteThread
public TCPIPWriteThread WriteThread
OutMessageQueue
public SimpleQueue OutMessageQueue
InMessageQueue
public SimpleQueue InMessageQueue
Player
public Player(Socket sss,
int outqueuelen,
int inqueuelen,
int player_nr,
int group_nr,
int rtsleep,
int wtsleep)
- Creates a new Player object.
No parameter checkings performed.
- Parameters:
- sss - Socket identifying the net entity.
- outqueuelen - Outgoing Message queue length
- inqueuelen - Incoming Message queue length
- player_nr - Client number used in identifying the client in the RoundRobinServerThread
- group_nr - Group number used in identifying the client in the RoundRobinServerThread
- rtsleep - ReadThread internal sleep delay
- wtsleep - WriteThread internal sleep delay
testOk
public boolean testOk()
- Tests if this player is ok, including threads etc.
- Returns:
- True if ok, false otherwise
down
public void down()
- Stops the threads of this player and cleans up.
setExitIfFullQueues
public void setExitIfFullQueues(boolean readq,
boolean writeq)
- Sets the behaviour of this player. If readq is true if the input queue
becomes full then the player goes down, otherwise not. Idem. for
writeq which controls the output queue
getGroup
public synchronized int getGroup()
- Gets the group number of the client.
setGroup
public synchronized void setGroup(int group_nr)
- Sets the group number of the client. (no checkings are done on parameters)
- Parameters:
- group_nr - The new group number to set