@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()
SessionRequest
getRemoteAddress
in interface SessionRequest
public SocketAddress getLocalAddress()
SessionRequest
getLocalAddress
in interface SessionRequest
public Object getAttachment()
SessionRequest
getAttachment
in interface SessionRequest
public boolean isCompleted()
SessionRequest
isCompleted
in interface SessionRequest
true
if the request has been completed,
false
if still pending.protected void setKey(SelectionKey key)
public void waitFor() throws InterruptedException
SessionRequest
waitFor
in interface SessionRequest
InterruptedException
- in case the execution process was
interrupted.public IOSession getSession()
SessionRequest
IOSession
instance created as a result of this request
or null
if the request is still pending.getSession
in interface SessionRequest
null
if the request is still pending.public IOException getException()
SessionRequest
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.getException
in interface SessionRequest
null
if no error occurred to
this point.public void completed(IOSession session)
public void failed(IOException exception)
public void timeout()
public int getConnectTimeout()
SessionRequest
getConnectTimeout
in interface SessionRequest
public void setConnectTimeout(int timeout)
SessionRequest
setConnectTimeout
in interface SessionRequest
timeout
- connect timeout value in milliseconds.public void cancel()
SessionRequest
SessionRequest.waitFor()
} method.cancel
in interface SessionRequest
Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.