|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.red5.server.AttributeStore
org.red5.server.BaseConnection
public abstract class BaseConnection
Base abstract class for connections. Adds connection specific functionality like work with clients to AttributeStore.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.red5.server.api.IConnection |
---|
IConnection.Encoding |
Field Summary | |
---|---|
protected Set<IBasicScope> |
basicScopes
Set of basic scopes. |
protected IClient |
client
Client bound to connection |
protected boolean |
closed
Is the connection closed? |
protected CopyOnWriteArrayList<IConnectionListener> |
connectionListeners
Listeners |
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 |
Fields inherited from class org.red5.server.AttributeStore |
---|
attributes |
Fields inherited from interface org.red5.server.api.IConnection |
---|
PERSISTENT, POLLING, TRANSIENT |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
void |
addListener(IConnectionListener listener)
Adds a listener to this object |
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()
Count of outgoing messages not yet written. |
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 |
boolean |
isReaderIdle()
Returns whether or not the reader is idle. |
boolean |
isWriterIdle()
Returns whether or not the writer is idle. |
void |
notifyEvent(IEvent event)
Notified on event |
void |
registerBasicScope(IBasicScope basicScope)
Registers basic scope |
void |
removeListener(IConnectionListener listener)
Removes the listener from this object |
void |
unregisterBasicScope(IBasicScope basicScope)
Unregister basic scope |
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, toString, wait, wait, wait |
Methods inherited from interface org.red5.server.api.IConnection |
---|
getEncoding, getLastPingTime, ping, setBandwidth |
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 |
---|
protected final String type
protected volatile String host
protected volatile String remoteAddress
protected volatile List<String> remoteAddresses
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
protected CopyOnWriteArrayList<IConnectionListener> connectionListeners
Constructor Detail |
---|
@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 clientMethod Detail |
---|
public void addListener(IConnectionListener listener)
addListener
in interface IConnection
public void removeListener(IConnectionListener listener)
removeListener
in interface IConnection
public static int getNextClientId()
public Semaphore getLock()
public void initialize(IClient client)
initialize
in interface IConnection
client
- Client bound to connectionpublic String getType()
IConnection
getType
in interface IConnection
public String getHost()
IConnection
getHost
in interface IConnection
public String getRemoteAddress()
IConnection
getRemoteAddress
in interface IConnection
public List<String> getRemoteAddresses()
IConnection
getRemoteAddresses
in interface IConnection
public int getRemotePort()
IConnection
getRemotePort
in interface IConnection
public String getPath()
IConnection
getPath
in interface IConnection
public String getSessionId()
IConnection
null
.
getSessionId
in interface IConnection
public Map<String,Object> getConnectParams()
getConnectParams
in interface IConnection
public IClient getClient()
IConnection
getClient
in interface IConnection
public boolean isConnected()
isConnected
in interface IConnection
public boolean connect(IScope newScope)
connect
in interface IConnection
newScope
- New scope
public boolean connect(IScope newScope, Object[] params)
connect
in interface IConnection
newScope
- New scopeparams
- Parameters to connect with
public IScope getScope()
IConnection
getScope
in interface IConnection
public void close()
close
in interface IConnection
public void notifyEvent(IEvent event)
notifyEvent
in interface IEventListener
event
- Eventpublic void dispatchEvent(IEvent event)
dispatchEvent
in interface IEventDispatcher
event
- Eventpublic boolean handleEvent(IEvent event)
handleEvent
in interface IEventHandler
event
- Event
public Iterator<IBasicScope> getBasicScopes()
IConnection
getBasicScopes
in interface IConnection
public void registerBasicScope(IBasicScope basicScope)
basicScope
- Basic scope to registerpublic void unregisterBasicScope(IBasicScope basicScope)
basicScope
- Unregister basic scopepublic abstract long getReadBytes()
IConnection
getReadBytes
in interface IConnection
public abstract long getWrittenBytes()
IConnection
getWrittenBytes
in interface IConnection
public long getReadMessages()
IConnection
getReadMessages
in interface IConnection
public long getWrittenMessages()
IConnection
getWrittenMessages
in interface IConnection
public long getDroppedMessages()
IConnection
getDroppedMessages
in interface IConnection
public boolean isReaderIdle()
public boolean isWriterIdle()
public long getPendingMessages()
getPendingMessages
in interface IConnection
public long getPendingVideoMessages(int streamId)
streamId
- the id you want to know about
public long getClientBytesRead()
getClientBytesRead
in interface IConnection
BytesRead
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |