## org.apache.http.impl.nio.reactor
Class SessionRequestImpl

    java.lang.Object
      org.apache.http.impl.nio.reactor.SessionRequestImpl

All Implemented Interfaces:
  SessionRequest

    @ThreadSafe
    public class SessionRequestImpl

extends Object
implements SessionRequest

Default implementation of `SessionRequest`.

Since:
  4.0

Constructor Summary
`SessionRequestImpl(SocketAddress remoteAddress, SocketAddress localAddress, Object attachment, SessionRequestCallback callback)`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SessionRequestImpl

    public SessionRequestImpl(SocketAddress remoteAddress,
                              SocketAddress localAddress,
                              Object attachment,
                              SessionRequestCallback callback)

Method Detail

### getRemoteAddress

    public SocketAddress getRemoteAddress()

  Description copied from interface: `SessionRequest`
  Returns socket address of the remote host.

  Specified by:
    `getRemoteAddress` in interface `SessionRequest`
  Returns:
    socket address of the remote host

### getLocalAddress

    public SocketAddress getLocalAddress()

  Description copied from interface: `SessionRequest`
  Returns local socket address.

  Specified by:
    `getLocalAddress` in interface `SessionRequest`
  Returns:
    local socket address.

### getAttachment

    public Object getAttachment()

  Description copied from interface: `SessionRequest`
  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.

  Specified by:
    `getAttachment` in interface `SessionRequest`
  Returns:
    attachment object.

### isCompleted

    public boolean isCompleted()

  Description copied from interface: `SessionRequest`
  Determines whether the request has been completed (either successfully or unsuccessfully).

  Specified by:
    `isCompleted` in interface `SessionRequest`
  Returns:
    `true</true> if the request has been completed, `false</true> if still pending.``

### setKey

    protected void setKey(SelectionKey key)

### waitFor

    public void waitFor()
                 throws InterruptedException

  Description copied from interface: `SessionRequest`
  Waits for completion of this session request.

  Specified by:
    `waitFor` in interface `SessionRequest`
  Throws:
    `InterruptedException` - in case the execution process was interrupted.

### getSession

    public IOSession getSession()

  Description copied from interface: `SessionRequest`
  Returns `IOSession` instance created as a result of this request or `null` if the request is still pending.

  Specified by:
    `getSession` in interface `SessionRequest`
  Returns:
    I/O session or `null` if the request is still pending.

### getException

    public IOException getException()

  Description copied from interface: `SessionRequest`
  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.

  Specified by:
    `getException` in interface `SessionRequest`
  Returns:
    I/O exception or `null` if no error occurred to this point.

### completed

    public void completed(IOSession session)

### failed

    public void failed(IOException exception)

### timeout

    public void timeout()

### getConnectTimeout

    public int getConnectTimeout()

  Description copied from interface: `SessionRequest`
  Returns connect timeout value in milliseconds.

  Specified by:
    `getConnectTimeout` in interface `SessionRequest`
  Returns:
    connect timeout value in milliseconds.

### setConnectTimeout

    public void setConnectTimeout(int timeout)

  Description copied from interface: `SessionRequest`
  Sets connect timeout value in milliseconds.

  Specified by:
    `setConnectTimeout` in interface `SessionRequest`
  Parameters:
    `timeout` - connect timeout value in milliseconds.

### cancel

    public void cancel()

  Description copied from interface: `SessionRequest`
  Cancels 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:
    `cancel` in interface `SessionRequest`

Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.