org.red5.server.net.rtmpt
Class RTMPTConnection

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.rtmpt.RTMPTConnection
All Implemented Interfaces:
AttributeStoreMBean, ConnectionMBean, IEventDispatcher, IEventHandler, IEventListener, IAttributeStore, IBWControllable, ICastingAttributeStore, IConnection, ICoreObject, IServiceCapableConnection, IStreamCapableConnection

public class RTMPTConnection
extends RTMPConnection

A RTMPT client / session.

Author:
The Red5 Project (red5@osflash.org), Joachim Bauch (jojo@struktur.de)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.red5.server.api.IConnection
IConnection.Encoding
 
Field Summary
protected  org.apache.mina.common.ByteBuffer buffer
          Byte buffer
protected  boolean closing
          Closing flag
protected  SimpleProtocolDecoder decoder
          Protocol decoder
protected  SimpleProtocolEncoder encoder
          Protocol encoder
protected  RTMPHandler handler
          RTMP events handler
protected static long INCREASE_POLLING_DELAY_COUNT
          Start to increase the polling delay after this many empty results
protected static byte INITIAL_POLLING_DELAY
          Polling delay to start with.
protected static org.slf4j.Logger log
           
protected static byte MAX_POLLING_DELAY
          Maximum polling delay.
protected  long noPendingMessages
          Timeframe without pending messages.
protected  List<Object> notifyMessages
          List of notification messages
protected  List<org.apache.mina.common.ByteBuffer> pendingMessages
          List of pending messages
protected  byte pollingDelay
          Polling delay value
protected  long readBytes
          Number of read bytes
protected  RTMPTServlet servlet
          Servlet that created this connection.
protected  long writtenBytes
          Number of written bytes
 
Fields inherited from class org.red5.server.net.rtmp.RTMPConnection
clientId, deferredResults, encoding, invokeId, keepAliveJobName, lastPingSent, lastPingTime, lastPongReceived, maxInactivity, oName, pendingCalls, pingInterval, state, streamBuffers
 
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
 
Method Summary
 void close()
          Closes connection
 List decode(org.apache.mina.common.ByteBuffer data)
          Decode data sent by the client.
 long getPendingMessages()
          Total number of messages that are pending to be sent to the connection.
 org.apache.mina.common.ByteBuffer getPendingMessages(int targetSize)
          Return any pending messages up to a given size.
 byte getPollingDelay()
          Return the polling delay to use.
 long getReadBytes()
          Total number of bytes read from the connection.
 long getWrittenBytes()
          Total number of bytes written to the connection.
 boolean isClosing()
          Getter for property 'closing'.
protected  void onInactive()
          Inactive state event handler.
 void rawWrite(org.apache.mina.common.ByteBuffer packet)
          Send raw data down the connection.
 void realClose()
          Real close
protected  void setServlet(RTMPTServlet servlet)
          Set the servlet that created the connection.
 void setServletRequest(javax.servlet.http.HttpServletRequest request)
          Setter for servlet request.
 void write(Packet packet)
          Send RTMP packet down the connection.
 
Methods inherited from class org.red5.server.net.rtmp.RTMPConnection
addClientStream, closeChannel, connect, createOutputStream, createStreamName, deleteStreamById, getBandwidthConfigure, getChannel, getClientBytesRead, getEncoding, getId, getInvokeId, getLastPingTime, getNextAvailableChannelId, getParentBWControllable, getPendingCall, getPendingVideoMessages, getState, getStreamByChannelId, getStreamById, getStreamIdForChannel, getStreams, getUsedStreamCount, getVideoCodecFactory, invoke, invoke, invoke, invoke, invoke, invoke, isChannelUsed, messageDropped, messageReceived, messageSent, newBroadcastStream, newPlaylistSubscriberStream, newSingleItemSubscriberStream, notify, notify, notify, notify, ping, ping, pingReceived, receivedBytesRead, registerDeferredResult, registerPendingCall, registerStream, rememberStreamBufferDuration, removeClientStream, reserveStreamId, retrievePendingCall, setBandwidthConfigure, setId, setMaxHandshakeTimeout, setMaxInactivity, setPingInterval, setSchedulingService, setState, setup, startRoundTripMeasurement, startWaitForHandshake, toString, unregisterDeferredResult, unregisterStream, unreserveStreamId, updateBytesRead, writingMessage
 
Methods inherited from class org.red5.server.BaseConnection
connect, dispatchEvent, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getType, getWrittenMessages, handleEvent, initialize, isConnected, notifyEvent, registerBasicScope, unregisterBasicScope
 
Methods inherited from class org.red5.server.AttributeStore
filterNull, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
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, isConnected
 
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
 
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
 

Field Detail

log

protected static org.slf4j.Logger log

INCREASE_POLLING_DELAY_COUNT

protected static final long INCREASE_POLLING_DELAY_COUNT
Start to increase the polling delay after this many empty results

See Also:
Constant Field Values

INITIAL_POLLING_DELAY

protected static final byte INITIAL_POLLING_DELAY
Polling delay to start with.

See Also:
Constant Field Values

MAX_POLLING_DELAY

protected static final byte MAX_POLLING_DELAY
Maximum polling delay.

See Also:
Constant Field Values

decoder

protected SimpleProtocolDecoder decoder
Protocol decoder


encoder

protected SimpleProtocolEncoder encoder
Protocol encoder


handler

protected RTMPHandler handler
RTMP events handler


buffer

protected org.apache.mina.common.ByteBuffer buffer
Byte buffer


pendingMessages

protected List<org.apache.mina.common.ByteBuffer> pendingMessages
List of pending messages


notifyMessages

protected List<Object> notifyMessages
List of notification messages


pollingDelay

protected byte pollingDelay
Polling delay value


noPendingMessages

protected long noPendingMessages
Timeframe without pending messages. If this time is greater then polling delay, then polling delay increased


readBytes

protected long readBytes
Number of read bytes


writtenBytes

protected long writtenBytes
Number of written bytes


closing

protected volatile boolean closing
Closing flag


servlet

protected RTMPTServlet servlet
Servlet that created this connection.

Method Detail

close

public void close()
Closes connection

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

setServlet

protected void setServlet(RTMPTServlet servlet)
Set the servlet that created the connection.

Parameters:
servlet -

isClosing

public boolean isClosing()
Getter for property 'closing'.

Returns:
Value for property 'closing'.

realClose

public void realClose()
Real close


onInactive

protected void onInactive()
Inactive state event handler.

Specified by:
onInactive in class RTMPConnection

setServletRequest

public void setServletRequest(javax.servlet.http.HttpServletRequest request)
Setter for servlet request.

Parameters:
request - Servlet request

getPollingDelay

public byte getPollingDelay()
Return the polling delay to use.

Returns:
the polling delay

decode

public List decode(org.apache.mina.common.ByteBuffer data)
Decode data sent by the client.

Parameters:
data - the data to decode
Returns:
a list of decoded objects

write

public void write(Packet packet)
Send RTMP packet down the connection.

Specified by:
write in class RTMPConnection
Parameters:
packet - the packet to send

rawWrite

public void rawWrite(org.apache.mina.common.ByteBuffer packet)
Send raw data down the connection.

Specified by:
rawWrite in class RTMPConnection
Parameters:
packet - the buffer containing the raw data

getPendingMessages

public org.apache.mina.common.ByteBuffer getPendingMessages(int targetSize)
Return any pending messages up to a given size.

Parameters:
targetSize - the size the resulting buffer should have
Returns:
a buffer containing the data to send or null if no messages are pending

getReadBytes

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

Specified by:
getReadBytes in interface ConnectionMBean
Specified by:
getReadBytes in interface IConnection
Overrides:
getReadBytes in class RTMPConnection
Returns:
Number of read bytes

getWrittenBytes

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

Specified by:
getWrittenBytes in interface ConnectionMBean
Specified by:
getWrittenBytes in interface IConnection
Overrides:
getWrittenBytes in class RTMPConnection
Returns:
Number of written bytes

getPendingMessages

public long getPendingMessages()
Total number of messages that are pending to be sent to the connection.

Specified by:
getPendingMessages in interface ConnectionMBean
Specified by:
getPendingMessages in interface IConnection
Overrides:
getPendingMessages in class BaseConnection
Returns:
Number of pending messages


Copyright © 2006-2007 the Red5 project.