|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.mischiefbox.pollserve.ConnectionInfo
Connection information object. Provides information about a single connection.
| Field Summary | |
protected BufferedInputStream |
bis
The input stream associated with the socket. |
protected BufferedOutputStream |
bos
The output stream associated with the socket. |
protected ConnectionHandler |
handler
The connection handler that created and is responsible for the connection. |
protected int |
iErrorCount
The consecutive error count on the connection. |
protected long |
lLastUseMillis
The last recorded time I/O was performed on the socket. |
static int |
MAX_ERROR
The maximum number of consecutive errors permitted for the connection. |
protected String |
sConnectionId
The connection id (used to identify the connection). |
protected Socket |
sock
The Socket associated with the connection. |
| Constructor Summary | |
ConnectionInfo(ConnectionHandler handler,
Socket sock,
int iConnectionId)
Create a new connection info object. |
|
| Method Summary | |
void |
addError()
Add to and check the error count. |
protected void |
finalize()
Finalizer, in case this goes out of scope. |
String |
getConnectionId()
Get the connection id. |
int |
getErrors()
Get the number of errors on the connection. |
BufferedInputStream |
getInputStream()
Get the input stream. |
long |
getLastUsedTime()
Get the last used time (in milliseconds). |
BufferedOutputStream |
getOutputStream()
Get the output stream. |
void |
resetError()
Reset the error count to zero (success in I/O). |
void |
setLastUsedTime()
Set the last used time to now. |
void |
shutdown()
Shut down the connection gracefully. |
void |
terminate()
Close the socket connection immediately. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int MAX_ERROR
protected ConnectionHandler handler
protected Socket sock
protected BufferedInputStream bis
protected BufferedOutputStream bos
protected String sConnectionId
protected int iErrorCount
protected long lLastUseMillis
| Constructor Detail |
public ConnectionInfo(ConnectionHandler handler,
Socket sock,
int iConnectionId)
handler - the connection handler that created the
connection info object.sock - the socket this connection will use for I/O.iConnectionId - the connection id.| Method Detail |
public String getConnectionId()
public long getLastUsedTime()
public void setLastUsedTime()
public BufferedInputStream getInputStream()
public BufferedOutputStream getOutputStream()
public void terminate()
public void shutdown()
public int getErrors()
public void addError()
public void resetError()
protected void finalize()
throws Throwable
finalize in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||