@Contract(threading=SAFE_CONDITIONAL) public class SessionRequestImpl extends Object implements SessionRequest
SessionRequest.| Constructor and Description |
|---|
SessionRequestImpl(SocketAddress remoteAddress,
SocketAddress localAddress,
Object attachment,
SessionRequestCallback callback) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels the request.
|
void |
completed(IOSession session) |
void |
failed(IOException exception) |
Object |
getAttachment()
Returns attachment object will be added to the session's context upon
initialization.
|
int |
getConnectTimeout()
Returns connect timeout value in milliseconds.
|
IOException |
getException()
Returns
IOException instance if the request could not be
successfully executed due to an I/O error or null if no
error occurred to this point. |
SocketAddress |
getLocalAddress()
Returns local socket address.
|
SocketAddress |
getRemoteAddress()
Returns socket address of the remote host.
|
IOSession |
getSession()
Returns
IOSession instance created as a result of this request
or null if the request is still pending. |
boolean |
isCompleted()
Determines whether the request has been completed (either successfully
or unsuccessfully).
|
void |
setConnectTimeout(int timeout)
Sets connect timeout value in milliseconds.
|
protected void |
setKey(SelectionKey key) |
void |
timeout() |
void |
waitFor()
Waits for completion of this session request.
|
public SessionRequestImpl(SocketAddress remoteAddress, SocketAddress localAddress, Object attachment, SessionRequestCallback callback)
public SocketAddress getRemoteAddress()
SessionRequestgetRemoteAddress in interface SessionRequestpublic SocketAddress getLocalAddress()
SessionRequestgetLocalAddress in interface SessionRequestpublic Object getAttachment()
SessionRequestgetAttachment in interface SessionRequestpublic boolean isCompleted()
SessionRequestisCompleted in interface SessionRequesttrue if the request has been completed,
false if still pending.protected void setKey(SelectionKey key)
public void waitFor()
throws InterruptedException
SessionRequestwaitFor in interface SessionRequestInterruptedException - in case the execution process was
interrupted.public IOSession getSession()
SessionRequestIOSession instance created as a result of this request
or null if the request is still pending.getSession in interface SessionRequestnull if the request is still pending.public IOException getException()
SessionRequestIOException instance if the request could not be
successfully executed due to an I/O error or null if no
error occurred to this point.getException in interface SessionRequestnull if no error occurred to
this point.public void completed(IOSession session)
public void failed(IOException exception)
public void timeout()
public int getConnectTimeout()
SessionRequestgetConnectTimeout in interface SessionRequestpublic void setConnectTimeout(int timeout)
SessionRequestsetConnectTimeout in interface SessionRequesttimeout - connect timeout value in milliseconds.public void cancel()
SessionRequestSessionRequest.waitFor()} method.cancel in interface SessionRequestCopyright © 2005–2022 The Apache Software Foundation. All rights reserved.