public abstract class BaseConnection extends AttributeStore implements IConnection
IConnection.Encoding| Modifier and Type | Field and Description |
|---|---|
protected Set<IBasicScope> |
basicScopes
Set of basic scopes.
|
protected IClient |
client
Client bound to connection
|
protected boolean |
closed
Is the connection closed?
|
protected AtomicLong |
droppedMessages
Number of dropped messages
|
protected String |
host
Connection host
|
protected Map<String,Object> |
params
Connection params passed from client with NetConnection.connect call
|
protected String |
path
Path of scope client connected to
|
protected AtomicLong |
readMessages
Number of read messages
|
protected String |
remoteAddress
Connection remote address
|
protected List<String> |
remoteAddresses
Connection remote addresses
|
protected int |
remotePort
Remote port
|
protected Scope |
scope
Scope that connection belongs to
|
protected String |
sessionId
Connection session identifier
|
protected String |
type
Connection type
|
protected AtomicLong |
writtenMessages
Number of written messages
|
attributesPERSISTENT, POLLING, TRANSIENT| Constructor and Description |
|---|
BaseConnection()
Creates a new persistent base connection
|
BaseConnection(String type)
Creates a new base connection with the given type.
|
BaseConnection(String type,
String host,
String remoteAddress,
int remotePort,
String path,
String sessionId,
Map<String,Object> params)
Creates a new base connection with the given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes connection
|
boolean |
connect(IScope newScope)
Connect to another scope on server
|
boolean |
connect(IScope newScope,
Object[] params)
Connect to another scope on server with given parameters
|
void |
dispatchEvent(IEvent event)
Dispatches event
|
boolean |
equals(Object obj) |
Iterator<IBasicScope> |
getBasicScopes()
Get the basic scopes this connection has subscribed.
|
IClient |
getClient()
Get the client object associated with this connection.
|
long |
getClientBytesRead()
Return number of written bytes the client reports to have received.
|
Map<String,Object> |
getConnectParams()
Return connection parameters
|
long |
getDroppedMessages()
Total number of messages that have been dropped.
|
String |
getHost()
Get the hostname that the client is connected to.
|
Semaphore |
getLock() |
static int |
getNextClientId()
Returns the next available client id.
|
String |
getPath()
Get the path for this connection.
|
long |
getPendingMessages()
Total number of messages that are pending to be sent to the connection.
|
long |
getPendingVideoMessages(int streamId) |
abstract long |
getReadBytes()
Total number of bytes read from the connection.
|
long |
getReadMessages()
Total number of messages read from the connection.
|
String |
getRemoteAddress()
Get the IP address the client is connected from.
|
List<String> |
getRemoteAddresses()
Get the IP addresses the client is connected from.
|
int |
getRemotePort()
Get the port the client is connected from.
|
IScope |
getScope()
Get the scope this is connected to.
|
String |
getSessionId()
Get the session id, this may be
null. |
String |
getType()
Get the connection type.
|
abstract long |
getWrittenBytes()
Total number of bytes written to the connection.
|
long |
getWrittenMessages()
Total number of messages written to the connection.
|
boolean |
handleEvent(IEvent event)
Handles event
|
int |
hashCode() |
void |
initialize(IClient client)
Initializes client
|
boolean |
isConnected()
Check whether connection is alive
|
void |
notifyEvent(IEvent event)
Notified on event
|
void |
registerBasicScope(IBasicScope basicScope)
Registers basic scope
|
void |
unregisterBasicScope(IBasicScope basicScope)
Unregister basic scope
|
filterNull, from, getAttribute, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributesclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetEncoding, getLastPingTime, ping, setBandwidthgetBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttributegetAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributesprotected final String type
protected volatile String host
protected volatile String remoteAddress
protected volatile int remotePort
protected volatile String path
protected volatile String sessionId
protected AtomicLong readMessages
protected AtomicLong writtenMessages
protected AtomicLong droppedMessages
protected volatile Map<String,Object> params
protected volatile IClient client
protected volatile Scope scope
protected Set<IBasicScope> basicScopes
protected volatile boolean closed
@ConstructorProperties(value="persistent") public BaseConnection()
@ConstructorProperties(value="type") public BaseConnection(String type)
type - Connection type@ConstructorProperties(value={"type","host","remoteAddress","remotePort","path","sessionId"}) public BaseConnection(String type, String host, String remoteAddress, int remotePort, String path, String sessionId, Map<String,Object> params)
type - Connection typehost - HostremoteAddress - Remote addressremotePort - Remote portpath - Scope path on serversessionId - Session idparams - Params passed from clientpublic static int getNextClientId()
public Semaphore getLock()
public void initialize(IClient client)
initialize in interface IConnectionclient - Client bound to connectionpublic String getType()
IConnectiongetType in interface IConnectionpublic String getHost()
IConnectiongetHost in interface IConnectionpublic String getRemoteAddress()
IConnectiongetRemoteAddress in interface IConnectionpublic List<String> getRemoteAddresses()
IConnectiongetRemoteAddresses in interface IConnectionpublic int getRemotePort()
IConnectiongetRemotePort in interface IConnectionpublic String getPath()
IConnectiongetPath in interface IConnectionpublic String getSessionId()
IConnectionnull.getSessionId in interface IConnectionpublic Map<String,Object> getConnectParams()
getConnectParams in interface IConnectionpublic IClient getClient()
IConnectiongetClient in interface IConnectionpublic boolean isConnected()
isConnected in interface IConnectionpublic boolean connect(IScope newScope)
connect in interface IConnectionnewScope - New scopepublic boolean connect(IScope newScope, Object[] params)
connect in interface IConnectionnewScope - New scopeparams - Parameters to connect withpublic IScope getScope()
IConnectiongetScope in interface IConnectionpublic void close()
close in interface IConnectionpublic void notifyEvent(IEvent event)
notifyEvent in interface IEventListenerevent - Eventpublic void dispatchEvent(IEvent event)
dispatchEvent in interface IEventDispatcherevent - Eventpublic boolean handleEvent(IEvent event)
handleEvent in interface IEventHandlerevent - Eventpublic Iterator<IBasicScope> getBasicScopes()
IConnectiongetBasicScopes in interface IConnectionpublic void registerBasicScope(IBasicScope basicScope)
basicScope - Basic scope to registerpublic void unregisterBasicScope(IBasicScope basicScope)
basicScope - Unregister basic scopepublic abstract long getReadBytes()
IConnectiongetReadBytes in interface IConnectionpublic abstract long getWrittenBytes()
IConnectiongetWrittenBytes in interface IConnectionpublic long getReadMessages()
IConnectiongetReadMessages in interface IConnectionpublic long getWrittenMessages()
IConnectiongetWrittenMessages in interface IConnectionpublic long getDroppedMessages()
IConnectiongetDroppedMessages in interface IConnectionpublic long getPendingMessages()
IConnectiongetPendingMessages in interface IConnectionpublic long getPendingVideoMessages(int streamId)
streamId - the id you want to know aboutpublic long getClientBytesRead()
getClientBytesRead in interface IConnectionBytesReadCopyright © 2006-2012 The Red5 Project