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
Modifier and TypeFieldDescriptionprotected static ApplicationContext
protected ConcurrentMap<String,
RTMPConnection> protected AtomicInteger
protected boolean
private ScheduledExecutorService
protected static IConnectionManager<RTMPConnection>
private static final org.slf4j.Logger
-
Constructor Summary
-
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.void
destroy()
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.void
setApplicationContext
(ApplicationContext applicationContext) void
setConnection
(RTMPConnection conn) Adds a connection.void
setDebug
(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:
createConnection
in interfaceIConnectionManager<RTMPConnection>
- Parameters:
connCls
- class- Returns:
- connection
-
createConnection
Creates a connection of the type specified with associated session id.- Specified by:
createConnection
in interfaceIConnectionManager<RTMPConnection>
- Parameters:
connCls
- classsessionId
- session id- Returns:
- connection
-
setConnection
Adds a connection.- Specified by:
setConnection
in interfaceIConnectionManager<RTMPConnection>
- Parameters:
conn
- connection
-
getConnection
Returns a connection for a given client id.- Specified by:
getConnection
in interfaceIConnectionManager<RTMPConnection>
- Parameters:
clientId
- client id- Returns:
- connection if found and null otherwise
-
getConnectionBySessionId
Returns a connection for a given session id.- Specified by:
getConnectionBySessionId
in 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:
removeConnection
in interfaceIConnectionManager<RTMPConnection>
- Parameters:
clientId
- client id- Returns:
- connection
-
removeConnection
Removes a connection by the given sessionId.- Specified by:
removeConnection
in interfaceIConnectionManager<RTMPConnection>
- Parameters:
sessionId
- session id- Returns:
- connection that was removed
-
getAllConnections
Returns all the current connections. It doesn't remove anything.- Specified by:
getAllConnections
in interfaceIConnectionManager<RTMPConnection>
- Returns:
- list of connections
-
removeConnections
Removes all the connections from the set.- Specified by:
removeConnections
in 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:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
destroy
- Specified by:
destroy
in interfaceDisposableBean
- Throws:
Exception
-