|
Jive Forums API (5.5.8) Developer Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jivesoftware.forum.net.spi.SocketChannelConnection
public class SocketChannelConnection
A connection based on the nio socket channel.
This implementation will only work on JDK 1.4 or later JVMs.
| Field Summary |
|---|
| Fields inherited from interface com.jivesoftware.forum.net.Connection |
|---|
STATUS_READ_ACTIVE, STATUS_READ_CLOSED, STATUS_READ_LOADED, STATUS_READ_READY, STATUS_READ_SCHEDULED |
| Constructor Summary | |
|---|---|
SocketChannelConnection(java.net.Socket socket,
int connectionID,
boolean isAcceptCreated,
boolean isSecure)
Creates a new connection using the given socket channel and basic settings. |
|
| Method Summary | |
|---|---|
void |
close()
Close this connection and remove registration with connection manager (if any). |
java.util.Date |
getConnectDate()
Obtain the date/time the connection was initially made. |
BandwidthMonitor |
getConsumerBandwidthMonitor()
Obtain the bandwidth monitor watching the raw network traffic for this connection's DataConsumer. |
int |
getID()
Obtain a unique key to identify this connection in the connection manager. |
java.net.InetAddress |
getLocalAddress()
Obtain the InetAddress describing the local side of the connection. |
int |
getLocalPort()
Obtain the local port for this connection. |
BandwidthMonitor |
getProducerBandwidthMonitor()
Obtain the bandwidth monitor watching the raw network traffic for this connection's DataProducer. |
java.io.Reader |
getReader()
|
int |
getReadStatus()
Obtain the current read status of the connection. |
java.net.InetAddress |
getRemoteAddress()
Obtain the InetAddress describing the connection. |
int |
getRemotePort()
Obtain the remote port for this connection. |
java.net.Socket |
getSocket()
|
long |
getUptime()
Obtain the number of milliseconds the connection has been open. |
java.io.Writer |
getWriter()
|
boolean |
isAcceptCreated()
Retrieve the mechanism used to open this connection |
boolean |
isClosed()
Retrieve the closed state of the Session. |
boolean |
isSecure()
Determines if this connection is secure. |
void |
setConnectionManager(ConnectionManager manager)
Sets the connection manager this connection belongs to. |
void |
setReadStatus(int readStatus)
Sets the current read status of the connection. |
void |
setSecure(boolean isSecure)
Sets the security status of this connection. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SocketChannelConnection(java.net.Socket socket,
int connectionID,
boolean isAcceptCreated,
boolean isSecure)
throws java.io.IOException
Creates a new connection using the given socket channel and basic settings.
socket - the socket this connection represents.connectionID - the identifier for this connection.isAcceptCreated - true if the connection was created
by a server accept() call.isSecure - True if the connection is currently secure.
java.io.IOException| Method Detail |
|---|
public int getID()
ConnectionObtain a unique key to identify this connection in the connection manager. The ID is primarily used by stateless admin interfaces (e.g. HTTP) to allow a connection to be easily identified across accesses to the connection manager. The ID is only unique within the server at the time the connection is alive. IDs will be recycled on particularly long lived servers and should not be assumed to identify the same connection across server restarts, server instances, cluster members, etc.
getID in interface Connectionpublic java.util.Date getConnectDate()
ConnectionObtain the date/time the connection was initially made.
getConnectDate in interface Connectionpublic long getUptime()
ConnectionObtain the number of milliseconds the connection has been open.
If the connection is still open, this is the time difference between the result of getConnectDate() and the current time (e.g. System.currentTimeMillis() otherwise it returns the number of milliseconds between the opening and closing of the connection.
getUptime in interface Connectionpublic BandwidthMonitor getConsumerBandwidthMonitor()
ConnectionObtain the bandwidth monitor watching the raw network traffic for this connection's DataConsumer.
getConsumerBandwidthMonitor in interface Connectionpublic BandwidthMonitor getProducerBandwidthMonitor()
ConnectionObtain the bandwidth monitor watching the raw network traffic for this connection's DataProducer.
getProducerBandwidthMonitor in interface Connectionpublic java.net.InetAddress getRemoteAddress()
ConnectionObtain the InetAddress describing the connection.
getRemoteAddress in interface Connectionpublic int getRemotePort()
ConnectionObtain the remote port for this connection.
getRemotePort in interface Connectionpublic java.net.InetAddress getLocalAddress()
ConnectionObtain the InetAddress describing the local side of the connection.
getLocalAddress in interface Connectionpublic int getLocalPort()
ConnectionObtain the local port for this connection.
getLocalPort in interface Connection
public void close()
throws java.io.IOException
close in interface Connectionjava.io.IOException - if there was problem closing the connection.public boolean isClosed()
Connection
isClosed in interface Connectionpublic boolean isAcceptCreated()
Connection
isAcceptCreated in interface Connectionpublic boolean isSecure()
ConnectionDetermines if this connection is secure.
isSecure in interface Connectionpublic void setSecure(boolean isSecure)
ConnectionSets the security status of this connection.
Ordinarily a connection is either insecure (standard Socket or SocketChannel) or secure (SSLSocket). However, many protocols including XMPP and NNTP allow the use of SASL where transport layer security can be established after the connection is created. So application level objects must be able to change the security status of a connection during such negotiations.
setSecure in interface ConnectionisSecure - true if the connection is secure (e.g. SSL/TLS).public void setConnectionManager(ConnectionManager manager)
ConnectionSets the connection manager this connection belongs to.
Connections may only have on connection manager at a time.
setConnectionManager in interface Connectionmanager - the connection manager for the connection.public int getReadStatus()
Connection
getReadStatus in interface Connectionpublic void setReadStatus(int readStatus)
Connection
setReadStatus in interface ConnectionreadStatus - the new status of the connectionpublic java.net.Socket getSocket()
getSocket in interface Connectionpublic java.io.Writer getWriter()
getWriter in interface Connectionpublic java.io.Reader getReader()
getReader in interface Connectionpublic java.lang.String toString()
toString in class java.lang.Object
|
Jive Forums Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||