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
FieldsModifier and TypeFieldDescriptionprotected booleanprivate final AtomicBooleanClosing flagprotected intprotected intprivate org.apache.mina.core.session.IoSessionMINA I/O session, connection between two end pointsprotected static org.slf4j.Loggerprivate ObjectNameMBean 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, stateFields inherited from class org.red5.server.BaseConnection
basicScopes, client, connectionListeners, droppedMessages, host, params, path, readMessages, remoteAddress, remoteAddresses, remotePort, scope, sessionId, type, writtenMessagesFields inherited from class org.red5.server.AttributeStore
attributesFields inherited from interface org.red5.server.api.IConnection
PERSISTENT, POLLING, TRANSIENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes connectionbooleanConnect to another scope on server with given parametersintintorg.apache.mina.core.session.IoSessionReturn MINA I/O session.intlongCount of outgoing messages not yet written.longTotal number of bytes read from the connection.longTotal number of bytes written to the connection.voidinvokeMethod(String method) booleanbooleanCheck whether connection is alivebooleanisIdle()Returns whether or not the connection has been idle for a maximum period.booleanReturns whether or not the reader is idle.booleanReturns whether or not the writer is idle.protected voidInactive state event handler.protected voidvoidsetBandwidthDetection(boolean bandwidthDetection) voidsetDefaultClientBandwidth(int defaultClientBandwidth) voidsetDefaultServerBandwidth(int defaultServerBandwidth) voidsetExecutor(ThreadPoolTaskExecutor executor) voidsetIoSession(org.apache.mina.core.session.IoSession protocolSession) Setter for MINA I/O session (connection).voidsetLimitType(int limitType) protected voidvoidWrite packet.voidwriteRaw(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, writingMessageMethods 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, unregisterBasicScopeMethods 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, sizeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.red5.server.api.IAttributeStore
getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes, sizeMethods inherited from interface org.red5.server.api.ICastingAttributeStore
getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttributeMethods 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, setStreamIdMethods inherited from interface org.red5.server.api.event.IEventHandler
handleEventMethods inherited from interface org.red5.server.api.event.IEventListener
notifyEventMethods 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:BaseConnectionConnect to another scope on server with given parameters- Specified by:
connectin interfaceIConnection- Overrides:
connectin classRTMPConnection- Parameters:
newScope- New scopeparams- Parameters to connect with- Returns:
- true on success, false otherwise
-
close
public void close()Closes connection- Specified by:
closein interfaceIConnection- Specified by:
closein interfaceRTMPConnectionMXBean- Overrides:
closein classRTMPConnection
-
getIoSession
public org.apache.mina.core.session.IoSession getIoSession()Return MINA I/O session.- Overrides:
getIoSessionin 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:
setExecutorin 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:
isReaderIdlein classBaseConnection- Returns:
- queued messages
-
isWriterIdle
public boolean isWriterIdle()Returns whether or not the writer is idle.- Overrides:
isWriterIdlein classBaseConnection- Returns:
- queued messages
-
getPendingMessages
public long getPendingMessages()Count of outgoing messages not yet written.- Specified by:
getPendingMessagesin interfaceIConnection- Specified by:
getPendingMessagesin interfaceRTMPConnectionMXBean- Overrides:
getPendingMessagesin classBaseConnection- Returns:
- pending messages
-
getReadBytes
public long getReadBytes()Total number of bytes read from the connection.- Specified by:
getReadBytesin interfaceIConnection- Specified by:
getReadBytesin interfaceRTMPConnectionMXBean- Overrides:
getReadBytesin classRTMPConnection- Returns:
- bytes read
-
getWrittenBytes
public long getWrittenBytes()Total number of bytes written to the connection.- Specified by:
getWrittenBytesin interfaceIConnection- Specified by:
getWrittenBytesin interfaceRTMPConnectionMXBean- Overrides:
getWrittenBytesin classRTMPConnection- Returns:
- bytes written
-
invokeMethod
- Specified by:
invokeMethodin interfaceRTMPMinaConnectionMXBean
-
isConnected
public boolean isConnected()Check whether connection is alive- Specified by:
isConnectedin interfaceIConnection- Specified by:
isConnectedin interfaceRTMPConnectionMXBean- Overrides:
isConnectedin 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:
isIdlein classRTMPConnection- Returns:
- true if max idle period has been exceeded, false otherwise
-
onInactive
protected void onInactive()Inactive state event handler.- Specified by:
onInactivein 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:
writein classRTMPConnection- Parameters:
out- Packet
-
writeRaw
public void writeRaw(org.apache.mina.core.buffer.IoBuffer out) Write raw byte buffer.- Specified by:
writeRawin classRTMPConnection- Parameters:
out- IoBuffer
-
registerJMX
protected void registerJMX() -
unregisterJMX
protected void unregisterJMX()
-