|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCADI.Server.Session.ClientSessions
public class ClientSessions
This class is used to save the sessions of the clients. This object will
be shared among the Worker threads, therefore
methods must garantee the access to the list.
| Field Summary | |
|---|---|
(package private) java.util.ArrayList<Session> |
sessionsList
Contains a list where the client sessions are saved. |
| Constructor Summary | |
|---|---|
ClientSessions()
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
add(Session session)
Adds the specified element to the end of the list. |
boolean |
belongs(java.lang.String cid1,
java.lang.String cid2)
Checks whether the cid1 and cid2 channel
identifiers belongs to the same session. |
void |
clear()
Remove all elements from the clients list |
void |
closeSession(java.lang.String cid)
Closes all channels that belongs to the same sessions, so the session is closed and removed from the sessions list. |
boolean |
contains(java.lang.String cid)
Returns true if the clients list contains the specified element. |
Session |
get(java.lang.String cid)
Returns the first element of the queue if it isn't empty, otherwise null. |
private int |
indexOf(java.lang.String cid)
Returns the index of the session which the channel cid
belongs to. |
boolean |
isEmpty()
Checks if there is a empty list of sessions. |
void |
list(java.io.PrintStream out)
Prints this ClientSessions out to the specified output stream. |
void |
remove(java.lang.String cid)
Removes the element that it is identifier by its session identifier. |
int |
size()
Returns the number of sessions. |
java.lang.String |
toString()
For debugging purpose. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
java.util.ArrayList<Session> sessionsList
| Constructor Detail |
|---|
public ClientSessions()
| Method Detail |
|---|
public boolean add(Session session)
session - element to be appended to this list.
public void remove(java.lang.String cid)
cid - the channel identifier.public Session get(java.lang.String cid)
public boolean contains(java.lang.String cid)
cid -
public boolean belongs(java.lang.String cid1,
java.lang.String cid2)
cid1 and cid2 channel
identifiers belongs to the same session.
cid1 - a channel identifier.cid2 - a channel identifier.
true if both channel identifiers belong to the same
session. Otherwise, returns false.public void closeSession(java.lang.String cid)
cid - the unique channel identifier.public int size()
public boolean isEmpty()
true if there is not any sessions. Otherwise,
returns false.public void clear()
public java.lang.String toString()
toString in class java.lang.Objectpublic void list(java.io.PrintStream out)
out - an output stream.private int indexOf(java.lang.String cid)
cid
belongs to. If the channel is not in the sessions, returns -1
.
cid - the channel identifier.
sessionsList, or
-1 if the channel is not the list.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||