Package org.apache.http.nio.reactor
Interface SessionRequest
-
- All Known Implementing Classes:
SessionRequestImpl
public interface SessionRequestSessionRequest interface represents a request to establish a new connection (or session) to a remote host. It can be used to monitor the status of the request, to block waiting for its completion, or to cancel the request.Implementations of this interface are expected to be threading safe.
- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancel()Cancels the request.java.lang.ObjectgetAttachment()Returns attachment object will be added to the session's context upon initialization.intgetConnectTimeout()Returns connect timeout value in milliseconds.java.io.IOExceptiongetException()ReturnsIOExceptioninstance if the request could not be successfully executed due to an I/O error ornullif no error occurred to this point.java.net.SocketAddressgetLocalAddress()Returns local socket address.java.net.SocketAddressgetRemoteAddress()Returns socket address of the remote host.IOSessiongetSession()ReturnsIOSessioninstance created as a result of this request ornullif the request is still pending.booleanisCompleted()Determines whether the request has been completed (either successfully or unsuccessfully).voidsetConnectTimeout(int timeout)Sets connect timeout value in milliseconds.voidwaitFor()Waits for completion of this session request.
-
-
-
Method Detail
-
getRemoteAddress
java.net.SocketAddress getRemoteAddress()
Returns socket address of the remote host.- Returns:
- socket address of the remote host
-
getLocalAddress
java.net.SocketAddress getLocalAddress()
Returns local socket address.- Returns:
- local socket address.
-
getAttachment
java.lang.Object getAttachment()
Returns attachment object will be added to the session's context upon initialization. This object can be used to pass an initial processing state to the protocol handler.- Returns:
- attachment object.
-
isCompleted
boolean isCompleted()
Determines whether the request has been completed (either successfully or unsuccessfully).- Returns:
trueif the request has been completed,falseif still pending.
-
getSession
IOSession getSession()
ReturnsIOSessioninstance created as a result of this request ornullif the request is still pending.- Returns:
- I/O session or
nullif the request is still pending.
-
getException
java.io.IOException getException()
ReturnsIOExceptioninstance if the request could not be successfully executed due to an I/O error ornullif no error occurred to this point.- Returns:
- I/O exception or
nullif no error occurred to this point.
-
waitFor
void waitFor() throws java.lang.InterruptedExceptionWaits for completion of this session request.- Throws:
java.lang.InterruptedException- in case the execution process was interrupted.
-
setConnectTimeout
void setConnectTimeout(int timeout)
Sets connect timeout value in milliseconds.- Parameters:
timeout- connect timeout value in milliseconds.
-
getConnectTimeout
int getConnectTimeout()
Returns connect timeout value in milliseconds.- Returns:
- connect timeout value in milliseconds.
-
cancel
void cancel()
Cancels the request. Invocation of this method will set the status of the request to completed and will unblock threads blocked in the {waitFor()} method.
-
-