|
Jive Forums API (5.5.20.2-oracle) 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()
Connection
Obtain 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 Connection
public java.util.Date getConnectDate()
Connection
Obtain the date/time the connection was initially made.
getConnectDate
in interface Connection
public long getUptime()
Connection
Obtain 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 Connection
public BandwidthMonitor getConsumerBandwidthMonitor()
Connection
Obtain the bandwidth monitor watching the raw network traffic for this connection's DataConsumer.
getConsumerBandwidthMonitor
in interface Connection
public BandwidthMonitor getProducerBandwidthMonitor()
Connection
Obtain the bandwidth monitor watching the raw network traffic for this connection's DataProducer.
getProducerBandwidthMonitor
in interface Connection
public java.net.InetAddress getRemoteAddress()
Connection
Obtain the InetAddress describing the connection.
getRemoteAddress
in interface Connection
public int getRemotePort()
Connection
Obtain the remote port for this connection.
getRemotePort
in interface Connection
public java.net.InetAddress getLocalAddress()
Connection
Obtain the InetAddress describing the local side of the connection.
getLocalAddress
in interface Connection
public int getLocalPort()
Connection
Obtain the local port for this connection.
getLocalPort
in interface Connection
public void close() throws java.io.IOException
close
in interface Connection
java.io.IOException
- if there was problem closing the connection.public boolean isClosed()
Connection
isClosed
in interface Connection
public boolean isAcceptCreated()
Connection
isAcceptCreated
in interface Connection
public boolean isSecure()
Connection
Determines if this connection is secure.
isSecure
in interface Connection
public void setSecure(boolean isSecure)
Connection
Sets 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 Connection
isSecure
- true if the connection is secure (e.g. SSL/TLS).public void setConnectionManager(ConnectionManager manager)
Connection
Sets the connection manager this connection belongs to.
Connections may only have on connection manager at a time.
setConnectionManager
in interface Connection
manager
- the connection manager for the connection.public int getReadStatus()
Connection
getReadStatus
in interface Connection
public void setReadStatus(int readStatus)
Connection
setReadStatus
in interface Connection
readStatus
- the new status of the connectionpublic java.net.Socket getSocket()
getSocket
in interface Connection
public java.io.Writer getWriter()
getWriter
in interface Connection
public java.io.Reader getReader()
getReader
in interface Connection
public 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 |