Package net.targetr.rc
Class RoomManager
java.lang.Object
net.targetr.rc.RoomManager
Maintains a map of active rooms.
- Author:
- Dr Michael Gardiner
-
Method Summary
Modifier and TypeMethodDescriptionvoidcloseAll()Forcefully closes all network connections currently established to all rooms.static RoomManagerget()Retrieves the singleton RoomManager instance.intGets the total aggregate number of live clients in all rooms.Retrieves a room, or creates a new one if it does not exist.getRoom(ClientRequest req) Retrieves an existing room given a client request.intGets the total number of active rooms.getState()Aggregates state representations from all active rooms.
-
Method Details
-
get
Retrieves the singleton RoomManager instance.- Returns:
- the room manager
-
getRoom
Retrieves an existing room given a client request.- Parameters:
req- the incoming client request- Returns:
- the associated Room instance
-
getRoom
Retrieves a room, or creates a new one if it does not exist.- Parameters:
roomId- the requested room- Returns:
- the associated Room instance
-
getRoomCount
public int getRoomCount()Gets the total number of active rooms.- Returns:
- the room count
-
getLiveClientCount
public int getLiveClientCount()Gets the total aggregate number of live clients in all rooms.- Returns:
- the total client count
-
getState
Aggregates state representations from all active rooms.- Returns:
- a map organizing room states by their roomIds.
-
closeAll
public void closeAll()Forcefully closes all network connections currently established to all rooms. Designed to be called during application shutdown.
-