public class ClientsManager
extends java.lang.Object
Constructor and Description |
---|
ClientsManager(ServerViewController controller,
RequestsTimer timer) |
Modifier and Type | Method and Description |
---|---|
ClientData |
getClientData(int clientId)
We are assuming that no more than one thread will access
the same clientData during creation.
|
java.util.concurrent.locks.ReentrantLock |
getClientsLock() |
TOMMessage |
getPending(int reqId)
Get some reqId that is pending.
|
RequestList |
getPendingRequests()
Get pending requests in a fair way (one request from each client
queue until the max number of requests is obtained).
|
boolean |
havePendingRequests()
We've implemented some protection for individual client
data, but the clients table can change during the operation.
|
boolean |
isPending(int reqId)
Verifies if some reqId is pending.
|
boolean |
requestReceived(TOMMessage request,
boolean fromClient) |
boolean |
requestReceived(TOMMessage request,
boolean fromClient,
ServerCommunicationSystem cs)
Notifies the ClientsManager that a new request from a client arrived.
|
void |
requestsOrdered(TOMMessage[] requests)
Notifies the ClientsManager that these requests were already executed.
|
public ClientsManager(ServerViewController controller, RequestsTimer timer)
public ClientData getClientData(int clientId)
clientId
- public RequestList getPendingRequests()
public boolean havePendingRequests()
public boolean isPending(int reqId)
reqId
- the request identifierpublic TOMMessage getPending(int reqId)
reqId
- the request identifierpublic boolean requestReceived(TOMMessage request, boolean fromClient)
public boolean requestReceived(TOMMessage request, boolean fromClient, ServerCommunicationSystem cs)
request
- the received requestfromClient
- the message was received from client or not?storeMessage
- the message should be stored or not? (read-only requests are not stored)cs
- server com. system to be able to send replies to already processed requestspublic void requestsOrdered(TOMMessage[] requests)
requests
- the array of requests to account as orderedpublic java.util.concurrent.locks.ReentrantLock getClientsLock()