org.red5.server.net.rtmp
Class RTMPMinaConnection

java.lang.Object
  extended by org.red5.server.AttributeStore
      extended by org.red5.server.BaseConnection
          extended by org.red5.server.net.rtmp.RTMPConnection
              extended by org.red5.server.net.rtmp.RTMPMinaConnection
All Implemented Interfaces:
IEventDispatcher, IEventHandler, IEventListener, IAttributeStore, ICastingAttributeStore, IConnection, ICoreObject, IServiceCapableConnection, IStreamCapableConnection, AttributeStoreMXBean, RTMPMinaConnectionMXBean

@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
protected  boolean bandwidthDetection
           
protected  int defaultClientBandwidth
           
protected  int defaultServerBandwidth
           
protected static Logger log
           
 
Fields inherited from class org.red5.server.net.rtmp.RTMPConnection
bytesReadInterval, clientId, limitType, nextBytesRead, RTMP_CONNECTION_KEY, RTMP_ENCRYPTED, RTMP_HANDSHAKE, RTMP_NON_ENCRYPTED, RTMPE_CIPHER_IN, RTMPE_CIPHER_OUT, schedulingService, state
 
Fields inherited from class org.red5.server.BaseConnection
basicScopes, client, closed, 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
RTMPMinaConnection()
          Constructs a new RTMPMinaConnection.
 
Method Summary
 void close()
          Closes connection
 boolean connect(IScope newScope, Object[] params)
          Connect to another scope on server with given parameters
 int getDefaultClientBandwidth()
           
 int getDefaultServerBandwidth()
           
 IoSession getIoSession()
          Return MINA I/O session.
 int getLimitType()
           
 long getPendingMessages()
          Count of outgoing messages not yet written.
 long getReadBytes()
          Total number of bytes read from the connection.
 long getWrittenBytes()
          Total number of bytes written to the connection.
 void invokeMethod(String method)
           
 boolean isBandwidthDetection()
           
 boolean isConnected()
          Check whether connection is alive
 boolean isReaderIdle()
          Returns whether or not the reader is idle.
 boolean isWriterIdle()
          Returns whether or not the writer is idle.
protected  void onInactive()
          Inactive state event handler.
protected  void registerJMX()
           
 void setBandwidthDetection(boolean bandwidthDetection)
           
 void setDefaultClientBandwidth(int defaultClientBandwidth)
           
 void setDefaultServerBandwidth(int defaultServerBandwidth)
           
 void setIoSession(IoSession protocolSession)
          Setter for MINA I/O session (connection).
 void setLimitType(int limitType)
           
protected  void unregisterJMX()
           
 void write(Packet out)
          Write packet.
 void writeRaw(IoBuffer out)
          Write raw byte buffer.
 
Methods inherited from class org.red5.server.net.rtmp.RTMPConnection
addClientStream, closeChannel, createOutputStream, createStreamName, deleteStreamById, equals, getChannel, getClientBytesRead, getEncoding, getId, getInvokeId, getLastPingTime, getNextAvailableChannelId, getPendingCall, getPendingVideoMessages, getState, getStateCode, getStreamByChannelId, getStreamById, getStreamIdForChannel, getStreams, getTimer, getUsedStreamCount, hashCode, invoke, invoke, invoke, invoke, invoke, invoke, isChannelUsed, isValidStreamId, messageDropped, messageReceived, messageSent, newBroadcastStream, newPlaylistSubscriberStream, newSingleItemSubscriberStream, notify, notify, notify, notify, ping, ping, pingReceived, receivedBytesRead, registerDeferredResult, registerPendingCall, rememberStreamBufferDuration, removeClientStream, reserveStreamId, reserveStreamId, retrievePendingCall, sendPendingServiceCallsCloseError, sendSharedObjectMessage, setBandwidth, setId, setMaxHandshakeTimeout, setMaxInactivity, setPingInterval, setSchedulingService, setState, setStateCode, setup, startRoundTripMeasurement, startWaitForHandshake, status, status, toString, unregisterDeferredResult, unreserveStreamId, updateBytesRead, writingMessage
 
Methods inherited from class org.red5.server.BaseConnection
addListener, connect, dispatchEvent, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getLock, getNextClientId, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getType, getWrittenMessages, handleEvent, initialize, notifyEvent, registerBasicScope, removeListener, 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.jmx.mxbeans.RTMPMinaConnectionMXBean
getDroppedMessages, getHost, getPath, getPendingVideoMessages, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getSessionId, getType, getWrittenMessages
 
Methods inherited from interface org.red5.server.jmx.mxbeans.AttributeStoreMXBean
getAttributeNames, hasAttribute, removeAttribute, removeAttributes
 
Methods inherited from interface org.red5.server.api.IConnection
addListener, connect, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getType, getWrittenMessages, initialize, removeListener
 
Methods inherited from interface org.red5.server.api.event.IEventDispatcher
dispatchEvent
 
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.api.ICastingAttributeStore
getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute
 
Methods inherited from interface org.red5.server.api.IAttributeStore
getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes, size
 

Field Detail

log

protected static Logger log

defaultServerBandwidth

protected int defaultServerBandwidth

defaultClientBandwidth

protected int defaultClientBandwidth

bandwidthDetection

protected boolean bandwidthDetection
Constructor Detail

RTMPMinaConnection

@ConstructorProperties(value="persistent")
public RTMPMinaConnection()
Constructs a new RTMPMinaConnection.

Method Detail

connect

public boolean connect(IScope newScope,
                       Object[] params)
Description copied from class: BaseConnection
Connect to another scope on server with given parameters

Specified by:
connect in interface IConnection
Overrides:
connect in class RTMPConnection
Parameters:
newScope - New scope
params - Parameters to connect with
Returns:
true on success, false otherwise

close

public void close()
Closes connection

Specified by:
close in interface IConnection
Specified by:
close in interface RTMPMinaConnectionMXBean
Overrides:
close in class RTMPConnection

getIoSession

public IoSession getIoSession()
Return MINA I/O session.

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

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 class BaseConnection
Returns:
queued messages

isWriterIdle

public boolean isWriterIdle()
Returns whether or not the writer is idle.

Overrides:
isWriterIdle in class BaseConnection
Returns:
queued messages

getPendingMessages

public long getPendingMessages()
Count of outgoing messages not yet written.

Specified by:
getPendingMessages in interface IConnection
Specified by:
getPendingMessages in interface RTMPMinaConnectionMXBean
Overrides:
getPendingMessages in class BaseConnection
Returns:
pending messages

getReadBytes

public long getReadBytes()
Total number of bytes read from the connection.

Specified by:
getReadBytes in interface IConnection
Specified by:
getReadBytes in interface RTMPMinaConnectionMXBean
Overrides:
getReadBytes in class RTMPConnection
Returns:
bytes read

getWrittenBytes

public long getWrittenBytes()
Total number of bytes written to the connection.

Specified by:
getWrittenBytes in interface IConnection
Specified by:
getWrittenBytes in interface RTMPMinaConnectionMXBean
Overrides:
getWrittenBytes in class RTMPConnection
Returns:
bytes written

invokeMethod

public void invokeMethod(String method)
Specified by:
invokeMethod in interface RTMPMinaConnectionMXBean

isConnected

public boolean isConnected()
Check whether connection is alive

Specified by:
isConnected in interface IConnection
Specified by:
isConnected in interface RTMPMinaConnectionMXBean
Overrides:
isConnected in class BaseConnection
Returns:
true if connection is bound to scope, false otherwise

onInactive

protected void onInactive()
Inactive state event handler.

Specified by:
onInactive in class RTMPConnection

setIoSession

public void setIoSession(IoSession protocolSession)
Setter for MINA I/O session (connection).

Parameters:
protocolSession - Protocol session

write

public void write(Packet out)
Write packet.

Specified by:
write in class RTMPConnection
Parameters:
out - Packet

writeRaw

public void writeRaw(IoBuffer out)
Write raw byte buffer.

Specified by:
writeRaw in class RTMPConnection
Parameters:
out - IoBuffer

registerJMX

protected void registerJMX()

unregisterJMX

protected void unregisterJMX()


Copyright © 2006-2012 The Red5 Project