Package org.apache.http.impl.nio.reactor
Class SessionRequestImpl
java.lang.Object
org.apache.http.impl.nio.reactor.SessionRequestImpl
- All Implemented Interfaces:
SessionRequest
@Contract(threading=SAFE_CONDITIONAL)
public class SessionRequestImpl
extends Object
implements SessionRequest
Default implementation of
SessionRequest.- Since:
- 4.0
-
Constructor Summary
ConstructorsConstructorDescriptionSessionRequestImpl(SocketAddress remoteAddress, SocketAddress localAddress, Object attachment, SessionRequestCallback callback) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the request.voidvoidfailed(IOException exception) Returns attachment object will be added to the session's context upon initialization.intReturns connect timeout value in milliseconds.ReturnsIOExceptioninstance if the request could not be successfully executed due to an I/O error ornullif no error occurred to this point.Returns local socket address.Returns socket address of the remote host.ReturnsIOSessioninstance created as a result of this request ornullif the request is still pending.booleanDetermines whether the request has been completed (either successfully or unsuccessfully).voidsetConnectTimeout(int timeout) Sets connect timeout value in milliseconds.voidtimeout()voidwaitFor()Waits for completion of this session request.
-
Constructor Details
-
SessionRequestImpl
public SessionRequestImpl(SocketAddress remoteAddress, SocketAddress localAddress, Object attachment, SessionRequestCallback callback)
-
-
Method Details
-
getRemoteAddress
Description copied from interface:SessionRequestReturns socket address of the remote host.- Specified by:
getRemoteAddressin interfaceSessionRequest- Returns:
- socket address of the remote host
-
getLocalAddress
Description copied from interface:SessionRequestReturns local socket address.- Specified by:
getLocalAddressin interfaceSessionRequest- Returns:
- local socket address.
-
getAttachment
Description copied from interface:SessionRequestReturns 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.- Specified by:
getAttachmentin interfaceSessionRequest- Returns:
- attachment object.
-
isCompleted
public boolean isCompleted()Description copied from interface:SessionRequestDetermines whether the request has been completed (either successfully or unsuccessfully).- Specified by:
isCompletedin interfaceSessionRequest- Returns:
trueif the request has been completed,falseif still pending.
-
waitFor
Description copied from interface:SessionRequestWaits for completion of this session request.- Specified by:
waitForin interfaceSessionRequest- Throws:
InterruptedException- in case the execution process was interrupted.
-
getSession
Description copied from interface:SessionRequestReturnsIOSessioninstance created as a result of this request ornullif the request is still pending.- Specified by:
getSessionin interfaceSessionRequest- Returns:
- I/O session or
nullif the request is still pending.
-
getException
Description copied from interface:SessionRequestReturnsIOExceptioninstance if the request could not be successfully executed due to an I/O error ornullif no error occurred to this point.- Specified by:
getExceptionin interfaceSessionRequest- Returns:
- I/O exception or
nullif no error occurred to this point.
-
completed
-
failed
-
timeout
public void timeout() -
getConnectTimeout
public int getConnectTimeout()Description copied from interface:SessionRequestReturns connect timeout value in milliseconds.- Specified by:
getConnectTimeoutin interfaceSessionRequest- Returns:
- connect timeout value in milliseconds.
-
setConnectTimeout
public void setConnectTimeout(int timeout) Description copied from interface:SessionRequestSets connect timeout value in milliseconds.- Specified by:
setConnectTimeoutin interfaceSessionRequest- Parameters:
timeout- connect timeout value in milliseconds.
-
cancel
public void cancel()Description copied from interface:SessionRequestCancels the request. Invocation of this method will set the status of the request to completed and will unblock threads blocked in the {SessionRequest.waitFor()} method.- Specified by:
cancelin interfaceSessionRequest
-