Package org.apache.qpid.proton.reactor.impl

# Class SelectableImpl

java.lang.Object
org.apache.qpid.proton.reactor.impl.SelectableImpl

All Implemented Interfaces:
  `Extendable`, `ReactorChild`, `Selectable`

public class SelectableImpl extends Object implements Selectable

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.apache.qpid.proton.reactor.Selectable

`Selectable.Callback`

## Constructor Summary

Constructors
Constructor
Description
`SelectableImpl()`

## Method Summary

Modifier and Type
Method
Description
`Record`
`attachments()`
`void`
`error()`
Notify the selectable that an error has occurred.
`void`
`expired()`
Notify the selectable that it has expired.
`void`
`free()`
Notify the selectable that it has been free'd.
`SelectableChannel`
`getChannel()`
`long`
`getDeadline()`
`Reactor`
`getReactor()`
`protected Transport`
`getTransport()`
`boolean`
`isReading()`
`boolean`
`isRegistered()`
Check if a selectable is registered.
`boolean`
`isTerminal()`
`boolean`
`isTerminated()`
`boolean`
`isWriting()`
`void`
`onError(Selectable.Callback runnable)`
Registers a callback that will be run when the selectable is notified of an error.
`void`
`onExpired(Selectable.Callback runnable)`
Registers a callback that will be run when the selectable expires.
`void`
`onFree(Selectable.Callback runnable)`
Registers a callback that will be run when the selectable is notified that it has been free'd.
`void`
`onReadable(Selectable.Callback runnable)`
Registers a callback that will be run when the selectable becomes ready for reading.
`void`
`onRelease(Selectable.Callback runnable)`
Registers a callback that will be run when the selectable is notified that it has been released.
`void`
`onWritable(Selectable.Callback runnable)`
Registers a callback that will be run when the selectable becomes ready for writing.
`void`
`readable()`
Notify the selectable that the underlying `SelectableChannel` is ready for a read operation.
`void`
`release()`
Notify the selectable that it has been released.
`void`
`setChannel(SelectableChannel channel)`
Associates a `SelectableChannel` with this selector.
`void`
`setCollector(Collector collector)`
Configure a selectable with a set of callbacks that emit readable, writable, and expired events into the supplied collector.
`void`
`setDeadline(long deadline)`
Sets the value that will be returned by `Selectable.getDeadline()`.
`protected void`
`setReactor(Reactor reactor)`
`void`
`setReading(boolean reading)`
Sets the value that will be returned by `Selectable.isReading()`.
`void`
`setRegistered(boolean registered)`
Set the registered flag for a selectable.
`protected void`
`setTransport(Transport transport)`
`void`
`setWriting(boolean writing)`
Sets the value that will be returned by `Selectable.isWriting()`.
`void`
`terminate()`
Terminates the selectable.
`void`
`terminated()`
`void`
`writeable()`
Notify the selectable that the underlying `SelectableChannel` is ready for a write operation.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SelectableImpl

public SelectableImpl()

## Method Details

### isReading

public boolean isReading()

Specified by:
  `isReading` in interface `Selectable`
Returns:
  `true` if the selectable is interested in receiving notification (via the `Selectable.readable()` method that indicate that the associated `SelectableChannel` has data ready to be read from it.

### isWriting

public boolean isWriting()

Specified by:
  `isWriting` in interface `Selectable`
Returns:
  `true` if the selectable is interested in receiving notifications (via the `Selectable.writeable()` method that indicate that the associated `SelectableChannel` is ready to be written to.

### getDeadline

public long getDeadline()

Specified by:
  `getDeadline` in interface `Selectable`
Returns:
  a deadline after which this selectable can expect to receive a notification (via the `Selectable.expired()` method that indicates that the deadline has past. The deadline is expressed in the same format as `System.currentTimeMillis()`. Returning a deadline of zero (or a negative number) indicates that the selectable does not wish to be notified of expiry.

### setReading

public void setReading(boolean reading)
Description copied from interface: `Selectable`
Sets the value that will be returned by `Selectable.isReading()`.

Specified by:
  `setReading` in interface `Selectable`
Parameters:
  `reading` -

### setWriting

public void setWriting(boolean writing)
Description copied from interface: `Selectable`
Sets the value that will be returned by `Selectable.isWriting()`.

Specified by:
  `setWriting` in interface `Selectable`
Parameters:
  `writing` -

### setDeadline

public void setDeadline(long deadline)
Description copied from interface: `Selectable`
Sets the value that will be returned by `Selectable.getDeadline()`.

Specified by:
  `setDeadline` in interface `Selectable`
Parameters:
  `deadline` -

### onReadable

public void onReadable(Selectable.Callback runnable)
Description copied from interface: `Selectable`
Registers a callback that will be run when the selectable becomes ready for reading.

Specified by:
  `onReadable` in interface `Selectable`
Parameters:
  `runnable` - the callback to register. Any previously registered callback will be replaced.

### onWritable

public void onWritable(Selectable.Callback runnable)
Description copied from interface: `Selectable`
Registers a callback that will be run when the selectable becomes ready for writing.

Specified by:
  `onWritable` in interface `Selectable`
Parameters:
  `runnable` - the callback to register. Any previously registered callback will be replaced.

### onExpired

public void onExpired(Selectable.Callback runnable)
Description copied from interface: `Selectable`
Registers a callback that will be run when the selectable expires.

Specified by:
  `onExpired` in interface `Selectable`
Parameters:
  `runnable` - the callback to register. Any previously registered callback will be replaced.

### onError

public void onError(Selectable.Callback runnable)
Description copied from interface: `Selectable`
Registers a callback that will be run when the selectable is notified of an error.

Specified by:
  `onError` in interface `Selectable`
Parameters:
  `runnable` - the callback to register. Any previously registered callback will be replaced.

### onRelease

public void onRelease(Selectable.Callback runnable)
Description copied from interface: `Selectable`
Registers a callback that will be run when the selectable is notified that it has been released.

Specified by:
  `onRelease` in interface `Selectable`
Parameters:
  `runnable` - the callback to register. Any previously registered callback will be replaced.

### onFree

public void onFree(Selectable.Callback runnable)
Description copied from interface: `Selectable`
Registers a callback that will be run when the selectable is notified that it has been free'd.

Specified by:
  `onFree` in interface `Selectable`
Parameters:
  `runnable` - the callback to register. Any previously registered callback will be replaced.

### readable

public void readable()
Description copied from interface: `Selectable`
Notify the selectable that the underlying `SelectableChannel` is ready for a read operation.

Specified by:
  `readable` in interface `Selectable`

### writeable

public void writeable()
Description copied from interface: `Selectable`
Notify the selectable that the underlying `SelectableChannel` is ready for a write operation.

Specified by:
  `writeable` in interface `Selectable`

### expired

public void expired()
Description copied from interface: `Selectable`
Notify the selectable that it has expired.

Specified by:
  `expired` in interface `Selectable`

### error

public void error()
Description copied from interface: `Selectable`
Notify the selectable that an error has occurred.

Specified by:
  `error` in interface `Selectable`

### release

public void release()
Description copied from interface: `Selectable`
Notify the selectable that it has been released.

Specified by:
  `release` in interface `Selectable`

### free

public void free()
Description copied from interface: `Selectable`
Notify the selectable that it has been free'd.

Specified by:
  `free` in interface `ReactorChild`
Specified by:
  `free` in interface `Selectable`

### setChannel

public void setChannel(SelectableChannel channel)
Description copied from interface: `Selectable`
Associates a `SelectableChannel` with this selector.

Specified by:
  `setChannel` in interface `Selectable`
Parameters:
  `channel` -

### getChannel

public SelectableChannel getChannel()

Specified by:
  `getChannel` in interface `Selectable`
Returns:
  the `SelectableChannel` associated with this selector.

### isRegistered

public boolean isRegistered()
Description copied from interface: `Selectable`
Check if a selectable is registered. This can be used for tracking whether a given selectable has been registerd with an external event loop.

Note: the reactor code, currently, does not use this flag.

Specified by:
  `isRegistered` in interface `Selectable`
Returns:
  `true`if the selectable is registered.

### setRegistered

public void setRegistered(boolean registered)
Description copied from interface: `Selectable`
Set the registered flag for a selectable.

Note: the reactor code, currently, does not use this flag.

Specified by:
  `setRegistered` in interface `Selectable`
Parameters:
  `registered` - the value returned by `Selectable.isRegistered()`

### setCollector

public void setCollector(Collector collector)
Description copied from interface: `Selectable`
Configure a selectable with a set of callbacks that emit readable, writable, and expired events into the supplied collector.

Specified by:
  `setCollector` in interface `Selectable`
Parameters:
  `collector` -

### getReactor

public Reactor getReactor()

Specified by:
  `getReactor` in interface `Selectable`
Returns:
  the reactor to which this selectable is a child.

### terminate

public void terminate()
Description copied from interface: `Selectable`
Terminates the selectable. Once a selectable reaches a terminal state it will never be interested in events of any kind.

Specified by:
  `terminate` in interface `Selectable`

### isTerminal

public boolean isTerminal()

Specified by:
  `isTerminal` in interface `Selectable`
Returns:
  `true` if the selectable has reached a terminal state.

### getTransport

protected Transport getTransport()

### setTransport

protected void setTransport(Transport transport)

### setReactor

protected void setReactor(Reactor reactor)

### attachments

public Record attachments()

Specified by:
  `attachments` in interface `Extendable`

### isTerminated

public boolean isTerminated()

### terminated

public void terminated()