Package org.red5.server
Class ClientRegistry
java.lang.Object
org.red5.server.ClientRegistry
- All Implemented Interfaces:
IClientRegistry
,ClientRegistryMXBean
@ManagedResource(objectName="org.red5.server:type=ClientRegistry,name=default",
description="ClientRegistry")
public class ClientRegistry
extends Object
implements IClientRegistry, ClientRegistryMXBean
Registry for clients, wherein clients are mapped by their id.
- Author:
- The Red5 Project
-
Field Summary
Modifier and TypeFieldDescriptionprivate ConcurrentMap<String,
IClient> Clients mapprivate org.slf4j.Logger
private String
The identifier for this client registryprivate AtomicInteger
Next client id -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
Add the client to the registryvoid
Add client to registryReturns a list of Clients.protected Collection<IClient>
Return collection of clientsboolean
Check whether registry has client with given idprotected boolean
Check if client registry contains clients.lookupClient
(String id) Return client by idReturn client from next id with given paramsnextId()
Return next client idReturn previous client idprotected void
removeClient
(IClient client) Removes client from registry
-
Field Details
-
log
private org.slf4j.Logger log -
clients
Clients map -
nextId
Next client id -
name
The identifier for this client registry
-
-
Constructor Details
-
ClientRegistry
public ClientRegistry() -
ClientRegistry
-
-
Method Details
-
addClient
Add client to registry- Specified by:
addClient
in interfaceIClientRegistry
- Parameters:
client
- Client to add
-
addClient
Add the client to the registry -
getClient
- Specified by:
getClient
in interfaceClientRegistryMXBean
- Throws:
ClientNotFoundException
-
getClientList
Returns a list of Clients.- Specified by:
getClientList
in interfaceClientRegistryMXBean
-
hasClients
protected boolean hasClients()Check if client registry contains clients.- Returns:
True
if clients exist, otherwiseFalse
-
getClients
Return collection of clients- Returns:
- Collection of clients
-
hasClient
Check whether registry has client with given id- Specified by:
hasClient
in interfaceClientRegistryMXBean
- Specified by:
hasClient
in interfaceIClientRegistry
- Parameters:
id
- Client id- Returns:
- true if client with given id was register with this registry, false otherwise
-
lookupClient
Return client by id- Specified by:
lookupClient
in interfaceIClientRegistry
- Parameters:
id
- Client id- Returns:
- Client object associated with given id
- Throws:
ClientNotFoundException
- if we can't find client
-
newClient
Return client from next id with given params- Specified by:
newClient
in interfaceIClientRegistry
- Parameters:
params
- Client params- Returns:
- Client object
- Throws:
ClientNotFoundException
- if client not foundClientRejectedException
- if client rejected
-
nextId
Return next client id- Specified by:
nextId
in interfaceClientRegistryMXBean
- Returns:
- Next client id
-
previousId
Return previous client id- Specified by:
previousId
in interfaceClientRegistryMXBean
- Returns:
- Previous client id
-
removeClient
Removes client from registry- Parameters:
client
- Client to remove
-