Class 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"
  • Field Details

    • log

      protected static org.slf4j.Logger log
    • closing

      private final AtomicBoolean closing
      Closing flag
    • ioSession

      private transient org.apache.mina.core.session.IoSession ioSession
      MINA I/O session, connection between two end points
    • oName

      private ObjectName oName
      MBean object name used for de/registration purposes.
    • defaultServerBandwidth

      protected int defaultServerBandwidth
    • defaultClientBandwidth

      protected int defaultClientBandwidth
    • bandwidthDetection

      protected boolean bandwidthDetection
  • Constructor Details

    • RTMPMinaConnection

      @ConstructorProperties("persistent") public RTMPMinaConnection()
      Constructs a new RTMPMinaConnection.
  • Method Details

    • 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 RTMPConnectionMXBean
      Overrides:
      close in class RTMPConnection
    • getIoSession

      public org.apache.mina.core.session.IoSession getIoSession()
      Return MINA I/O session.
      Overrides:
      getIoSession in class RTMPConnection
      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

      public void setExecutor(ThreadPoolTaskExecutor executor)
      Overrides:
      setExecutor in class RTMPConnection
    • 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 RTMPConnectionMXBean
      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 RTMPConnectionMXBean
      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 RTMPConnectionMXBean
      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 RTMPConnectionMXBean
      Overrides:
      isConnected in class BaseConnection
      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 class RTMPConnection
      Returns:
      true if max idle period has been exceeded, 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()