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, 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

Fields
`protected boolean` `bandwidthDetection`
`protected int` `defaultClientBandwidth`
`protected int` `defaultServerBandwidth`
`protected static org.slf4j.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, state`

### Fields inherited from class org.red5.server.BaseConnection

`basicScopes, client, closed, 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

Constructors
Constructor and Description
`RTMPMinaConnection()` Constructs a new RTMPMinaConnection.

### Method Summary

Methods
`void` `close()` Closes connection
`boolean` `connect(IScope newScope, Object[] params)` Connect to another scope on server with given parameters
`int` `getDefaultClientBandwidth()`
`int` `getDefaultServerBandwidth()`
`org.apache.mina.core.session.IoSession` `getIoSession()` Return MINA I/O session.
`int` `getLimitType()`
`long` `getPendingMessages()` Total number of messages that are pending to be sent to the connection.
`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
`protected void` `onInactive()` Inactive state event handler.
`protected void` `registerJMX()`
`void` `setBandwidthDetection(boolean bandwidthDetection)`
`void` `setDefaultClientBandwidth(int defaultClientBandwidth)`
`void` `setDefaultServerBandwidth(int defaultServerBandwidth)`
`void` `setIoSession(org.apache.mina.core.session.IoSession protocolSession)` Setter for MINA I/O session (connection).
`void` `setLimitType(int limitType)`
`protected void` `unregisterJMX()`
`void` `write(Packet out)` 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, deleteStreamById, equals, getChannel, getClientBytesRead, getEncoding, getId, getInvokeId, getLastPingTime, getNextAvailableChannelId, getPendingCall, getPendingVideoMessages, getState, getStateCode, getStreamByChannelId, getStreamById, getStreamIdForChannel, getStreams, 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, setBandwidth, setId, setMaxHandshakeTimeout, setMaxInactivity, setPingInterval, setSchedulingService, setState, setStateCode, setup, startRoundTripMeasurement, startWaitForHandshake, toString, unregisterDeferredResult, unreserveStreamId, updateBytesRead, writingMessage`

### Methods inherited from class org.red5.server.BaseConnection

`connect, dispatchEvent, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getLock, getNextClientId, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getType, getWrittenMessages, handleEvent, initialize, notifyEvent, registerBasicScope, 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`

### 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

`connect, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getType, getWrittenMessages, initialize`

### 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`

### Field Detail

#### log

    protected static org.slf4j.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 org.apache.mina.core.session.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

#### getPendingMessages

    public long getPendingMessages()

Total number of messages that are pending to be sent to the connection.

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(org.apache.mina.core.session.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(org.apache.mina.core.buffer.IoBuffer out)

Write raw byte buffer.

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

#### registerJMX

    protected void registerJMX()

#### unregisterJMX

    protected void unregisterJMX()