Package org.red5.server.net.rtmp
Class RTMPConnManager
java.lang.Object
org.red5.server.net.rtmp.RTMPConnManager
- All Implemented Interfaces:
IConnectionManager<RTMPConnection>,Aware,DisposableBean,ApplicationContextAware
public class RTMPConnManager
extends Object
implements IConnectionManager<RTMPConnection>, ApplicationContextAware, DisposableBean
Responsible for management and creation of RTMP based connections.
- Author:
- The Red5 Project
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static ApplicationContextprotected ConcurrentMap<String,RTMPConnection> protected AtomicIntegerprotected booleanprivate ScheduledExecutorServiceprotected static IConnectionManager<RTMPConnection>private static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateConnection(Class<?> connCls) Creates a connection based on the given type class.createConnection(Class<?> connCls, String sessionId) Creates a connection of the type specified with associated session id.createConnectionInstance(Class<?> cls) Creates a connection instance based on the supplied type.voiddestroy()Returns all the current connections.getConnection(int clientId) Returns a connection for a given client id.getConnectionBySessionId(String sessionId) Returns a connection for a given session id.static IConnectionManager<RTMPConnection>removeConnection(int clientId) Removes a connection matching the client id specified.removeConnection(String sessionId) Removes a connection by the given sessionId.Removes all the connections from the set.voidsetApplicationContext(ApplicationContext applicationContext) voidsetConnection(RTMPConnection conn) Adds a connection.voidsetDebug(boolean debug)
-
Field Details
-
log
private static final org.slf4j.Logger log -
applicationContext
-
executor
-
connMap
-
conns
-
instance
-
debug
protected boolean debug
-
-
Constructor Details
-
RTMPConnManager
public RTMPConnManager()
-
-
Method Details
-
getInstance
-
createConnection
Creates a connection based on the given type class.- Specified by:
createConnectionin interfaceIConnectionManager<RTMPConnection>- Parameters:
connCls- class- Returns:
- connection
-
createConnection
Creates a connection of the type specified with associated session id.- Specified by:
createConnectionin interfaceIConnectionManager<RTMPConnection>- Parameters:
connCls- classsessionId- session id- Returns:
- connection
-
setConnection
Adds a connection.- Specified by:
setConnectionin interfaceIConnectionManager<RTMPConnection>- Parameters:
conn- connection
-
getConnection
Returns a connection for a given client id.- Specified by:
getConnectionin interfaceIConnectionManager<RTMPConnection>- Parameters:
clientId- client id- Returns:
- connection if found and null otherwise
-
getConnectionBySessionId
Returns a connection for a given session id.- Specified by:
getConnectionBySessionIdin interfaceIConnectionManager<RTMPConnection>- Parameters:
sessionId- session id- Returns:
- connection if found and null otherwise
-
removeConnection
Removes a connection matching the client id specified. If found, the connection will be returned.- Specified by:
removeConnectionin interfaceIConnectionManager<RTMPConnection>- Parameters:
clientId- client id- Returns:
- connection
-
removeConnection
Removes a connection by the given sessionId.- Specified by:
removeConnectionin interfaceIConnectionManager<RTMPConnection>- Parameters:
sessionId- session id- Returns:
- connection that was removed
-
getAllConnections
Returns all the current connections. It doesn't remove anything.- Specified by:
getAllConnectionsin interfaceIConnectionManager<RTMPConnection>- Returns:
- list of connections
-
removeConnections
Removes all the connections from the set.- Specified by:
removeConnectionsin interfaceIConnectionManager<RTMPConnection>- Returns:
- connections
-
createConnectionInstance
Creates a connection instance based on the supplied type.- Parameters:
cls- class- Returns:
- connection
- Throws:
Exception- on error
-
setDebug
public void setDebug(boolean debug) - Parameters:
debug- the debug to set
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
destroy
- Specified by:
destroyin interfaceDisposableBean- Throws:
Exception
-