Package org.red5.server.net.rtmp
Class RTMPMinaConnection
java.lang.Object
org.red5.server.AttributeStore
org.red5.server.BaseConnection
org.red5.server.net.rtmp.RTMPConnection
org.red5.server.net.rtmp.RTMPMinaConnection
- All Implemented Interfaces:
IEventDispatcher
,IEventHandler
,IEventListener
,IAttributeStore
,ICastingAttributeStore
,IConnection
,ICoreObject
,IServiceCapableConnection
,IStreamCapableConnection
,AttributeStoreMXBean
,RTMPConnectionMXBean
,RTMPMinaConnectionMXBean
,IReceivedMessageTaskQueueListener
@ManagedResource
public class RTMPMinaConnection
extends RTMPConnection
implements RTMPMinaConnectionMXBean
Represents an RTMP connection using Mina.
- Author:
- Paul Gregoire
- See Also:
-
- "http://mina.apache.org/report/trunk/apidocs/org/apache/mina/core/session/IoSession.html"
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.red5.server.api.IConnection
IConnection.Encoding
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
private final AtomicBoolean
Closing flagprotected int
protected int
private org.apache.mina.core.session.IoSession
MINA I/O session, connection between two end pointsprotected static org.slf4j.Logger
private ObjectName
MBean object name used for de/registration purposes.Fields inherited from class org.red5.server.net.rtmp.RTMPConnection
bytesReadInterval, deadlockGuardScheduler, decoderLock, decoderState, encoderLock, executor, handler, limitType, MAX_RESERVED_STREAMS, maxHandlingTimeout, maxInactivity, nextBytesRead, RTMP_CONN_MANAGER, RTMP_ENCRYPTED, RTMP_ENCRYPTED_BLOWFISH, RTMP_ENCRYPTED_UNK, RTMP_ENCRYPTED_XTEA, RTMP_HANDLER, RTMP_HANDSHAKE, RTMP_NON_ENCRYPTED, RTMP_SESSION_ID, RTMPE_CIPHER_IN, RTMPE_CIPHER_OUT, running, scheduler, state
Fields inherited from class org.red5.server.BaseConnection
basicScopes, client, connectionListeners, droppedMessages, host, params, path, readMessages, remoteAddress, remoteAddresses, remotePort, scope, sessionId, type, writtenMessages
Fields inherited from class org.red5.server.AttributeStore
attributes
Fields inherited from interface org.red5.server.api.IConnection
PERSISTENT, POLLING, TRANSIENT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes connectionboolean
Connect to another scope on server with given parametersint
int
org.apache.mina.core.session.IoSession
Return MINA I/O session.int
long
Count of outgoing messages not yet written.long
Total number of bytes read from the connection.long
Total number of bytes written to the connection.void
invokeMethod
(String method) boolean
boolean
Check whether connection is aliveboolean
isIdle()
Returns whether or not the connection has been idle for a maximum period.boolean
Returns whether or not the reader is idle.boolean
Returns whether or not the writer is idle.protected void
Inactive state event handler.protected void
void
setBandwidthDetection
(boolean bandwidthDetection) void
setDefaultClientBandwidth
(int defaultClientBandwidth) void
setDefaultServerBandwidth
(int defaultServerBandwidth) void
setExecutor
(ThreadPoolTaskExecutor executor) void
setIoSession
(org.apache.mina.core.session.IoSession protocolSession) Setter for MINA I/O session (connection).void
setLimitType
(int limitType) protected void
void
Write packet.void
writeRaw
(org.apache.mina.core.buffer.IoBuffer out) Write raw byte buffer.Methods inherited from class org.red5.server.net.rtmp.RTMPConnection
addClientStream, closeChannel, createOutputStream, createStreamName, currentQueueSize, deleteStreamById, dispatchEvent, getChannel, getChannelIdForStreamId, getChannelsConcurrencyLevel, getChannelsInitalCapacity, getClientBytesRead, getDeadlockGuardScheduler, getDecoderLock, getDecoderState, getEncoderLock, getEncoding, getExecutor, getHandler, getId, getLastPingSentAndLastPongReceivedInterval, getLastPingTime, getMaxHandlingTimeout, getNextAvailableChannelId, getPendingCall, getPendingCallsConcurrencyLevel, getPendingCallsInitalCapacity, getPendingVideoMessages, getProtocol, getReservedStreamsConcurrencyLevel, getReservedStreamsInitalCapacity, getScheduler, getState, getStateCode, getStreamByChannelId, getStreamById, getStreamIdForChannelId, getStreams, getStreamsConcurrencyLevel, getStreamsInitalCapacity, getStreamsMap, getTimer, getTransactionId, getUsedStreamCount, handleMessageReceived, invoke, invoke, invoke, invoke, invoke, invoke, isChannelUsed, isDisconnected, isValidStreamId, logStream, logWarning, messageDropped, messageReceived, messageSent, messageTypeToName, newBroadcastStream, newPlaylistSubscriberStream, newSingleItemSubscriberStream, notify, notify, notify, notify, onTaskAdded, onTaskRemoved, open, ping, ping, pingReceived, receivedBytesRead, registerDeferredResult, registerPendingCall, rememberStreamBufferDuration, removeClientStream, reserveStreamId, reserveStreamId, retrievePendingCall, sendPendingServiceCallsCloseError, setBandwidth, setChannelsConcurrencyLevel, setChannelsInitalCapacity, setDeadlockGuardScheduler, setExecutorQueueSizeToDropAudioPackets, setHandler, setId, setMaxHandlingTimeout, setMaxHandshakeTimeout, setMaxInactivity, setPendingCallsConcurrencyLevel, setPendingCallsInitalCapacity, setPingInterval, setReservedStreamsConcurrencyLevel, setReservedStreamsInitalCapacity, setScheduler, setStateCode, setStreamsConcurrencyLevel, setStreamsInitalCapacity, setup, startWaitForHandshake, status, status, toString, unregisterDeferredResult, unreserveStreamId, updateBytesRead, writingMessage
Methods inherited from class org.red5.server.BaseConnection
addListener, connect, equals, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getLock, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getStreamId, getType, getWrittenMessages, handleEvent, hashCode, initialize, isClosed, notifyEvent, registerBasicScope, removeListener, setClient, setStreamId, unregisterBasicScope
Methods inherited from class org.red5.server.AttributeStore
filterNull, from, getAttribute, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes, size
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.red5.server.api.IAttributeStore
getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes, size
Methods inherited from interface org.red5.server.api.ICastingAttributeStore
getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute
Methods inherited from interface org.red5.server.api.IConnection
addListener, connect, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getStreamId, getType, getWrittenMessages, initialize, removeListener, setClient, setStreamId
Methods inherited from interface org.red5.server.api.event.IEventHandler
handleEvent
Methods inherited from interface org.red5.server.api.event.IEventListener
notifyEvent
Methods inherited from interface org.red5.server.jmx.mxbeans.RTMPConnectionMXBean
getDroppedMessages, getHost, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getSessionId, getType, getWrittenMessages
-
Field Details
-
log
protected static org.slf4j.Logger log -
closing
Closing flag -
ioSession
private transient org.apache.mina.core.session.IoSession ioSessionMINA I/O session, connection between two end points -
oName
MBean object name used for de/registration purposes. -
defaultServerBandwidth
protected int defaultServerBandwidth -
defaultClientBandwidth
protected int defaultClientBandwidth -
bandwidthDetection
protected boolean bandwidthDetection
-
-
Constructor Details
-
RTMPMinaConnection
Constructs a new RTMPMinaConnection.
-
-
Method Details
-
connect
Description copied from class:BaseConnection
Connect to another scope on server with given parameters- Specified by:
connect
in interfaceIConnection
- Overrides:
connect
in classRTMPConnection
- Parameters:
newScope
- New scopeparams
- Parameters to connect with- Returns:
- true on success, false otherwise
-
close
public void close()Closes connection- Specified by:
close
in interfaceIConnection
- Specified by:
close
in interfaceRTMPConnectionMXBean
- Overrides:
close
in classRTMPConnection
-
getIoSession
public org.apache.mina.core.session.IoSession getIoSession()Return MINA I/O session.- Overrides:
getIoSession
in classRTMPConnection
- Returns:
- MINA O/I session, connection between two end-points
-
getDefaultServerBandwidth
public int getDefaultServerBandwidth()- Returns:
- the defaultServerBandwidth
-
setDefaultServerBandwidth
public void setDefaultServerBandwidth(int defaultServerBandwidth) - Parameters:
defaultServerBandwidth
- the defaultServerBandwidth to set
-
getDefaultClientBandwidth
public int getDefaultClientBandwidth()- Returns:
- the defaultClientBandwidth
-
setDefaultClientBandwidth
public void setDefaultClientBandwidth(int defaultClientBandwidth) - Parameters:
defaultClientBandwidth
- the defaultClientBandwidth to set
-
getLimitType
public int getLimitType()- Returns:
- the limitType
-
setLimitType
public void setLimitType(int limitType) - Parameters:
limitType
- the limitType to set
-
setExecutor
- Overrides:
setExecutor
in classRTMPConnection
-
isBandwidthDetection
public boolean isBandwidthDetection()- Returns:
- the bandwidthDetection
-
setBandwidthDetection
public void setBandwidthDetection(boolean bandwidthDetection) - Parameters:
bandwidthDetection
- the bandwidthDetection to set
-
isReaderIdle
public boolean isReaderIdle()Returns whether or not the reader is idle.- Overrides:
isReaderIdle
in classBaseConnection
- Returns:
- queued messages
-
isWriterIdle
public boolean isWriterIdle()Returns whether or not the writer is idle.- Overrides:
isWriterIdle
in classBaseConnection
- Returns:
- queued messages
-
getPendingMessages
public long getPendingMessages()Count of outgoing messages not yet written.- Specified by:
getPendingMessages
in interfaceIConnection
- Specified by:
getPendingMessages
in interfaceRTMPConnectionMXBean
- Overrides:
getPendingMessages
in classBaseConnection
- Returns:
- pending messages
-
getReadBytes
public long getReadBytes()Total number of bytes read from the connection.- Specified by:
getReadBytes
in interfaceIConnection
- Specified by:
getReadBytes
in interfaceRTMPConnectionMXBean
- Overrides:
getReadBytes
in classRTMPConnection
- Returns:
- bytes read
-
getWrittenBytes
public long getWrittenBytes()Total number of bytes written to the connection.- Specified by:
getWrittenBytes
in interfaceIConnection
- Specified by:
getWrittenBytes
in interfaceRTMPConnectionMXBean
- Overrides:
getWrittenBytes
in classRTMPConnection
- Returns:
- bytes written
-
invokeMethod
- Specified by:
invokeMethod
in interfaceRTMPMinaConnectionMXBean
-
isConnected
public boolean isConnected()Check whether connection is alive- Specified by:
isConnected
in interfaceIConnection
- Specified by:
isConnected
in interfaceRTMPConnectionMXBean
- Overrides:
isConnected
in classBaseConnection
- Returns:
- true if connection is bound to scope, false otherwise
-
isIdle
public boolean isIdle()Returns whether or not the connection has been idle for a maximum period.- Overrides:
isIdle
in classRTMPConnection
- Returns:
- true if max idle period has been exceeded, false otherwise
-
onInactive
protected void onInactive()Inactive state event handler.- Specified by:
onInactive
in classRTMPConnection
-
setIoSession
public void setIoSession(org.apache.mina.core.session.IoSession protocolSession) Setter for MINA I/O session (connection).- Parameters:
protocolSession
- Protocol session
-
write
Write packet.- Specified by:
write
in classRTMPConnection
- Parameters:
out
- Packet
-
writeRaw
public void writeRaw(org.apache.mina.core.buffer.IoBuffer out) Write raw byte buffer.- Specified by:
writeRaw
in classRTMPConnection
- Parameters:
out
- IoBuffer
-
registerJMX
protected void registerJMX() -
unregisterJMX
protected void unregisterJMX()
-