Class SelectableImpl
java.lang.Object
org.apache.qpid.proton.reactor.impl.SelectableImpl
- All Implemented Interfaces:
Extendable
,ReactorChild
,Selectable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.qpid.proton.reactor.Selectable
Selectable.Callback
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.long
protected Transport
boolean
boolean
Check if a selectable is registered.boolean
boolean
boolean
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 underlyingSelectableChannel
is ready for a read operation.void
release()
Notify the selectable that it has been released.void
setChannel
(SelectableChannel channel) Associates aSelectableChannel
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 bySelectable.getDeadline()
.protected void
setReactor
(Reactor reactor) void
setReading
(boolean reading) Sets the value that will be returned bySelectable.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 bySelectable.isWriting()
.void
Terminates the selectable.void
void
Notify the selectable that the underlyingSelectableChannel
is ready for a write operation.
-
Constructor Details
-
SelectableImpl
public SelectableImpl()
-
-
Method Details
-
isReading
public boolean isReading()- Specified by:
isReading
in interfaceSelectable
- Returns:
true
if the selectable is interested in receiving notification (via theSelectable.readable()
method that indicate that the associatedSelectableChannel
has data ready to be read from it.
-
isWriting
public boolean isWriting()- Specified by:
isWriting
in interfaceSelectable
- Returns:
true
if the selectable is interested in receiving notifications (via theSelectable.writeable()
method that indicate that the associatedSelectableChannel
is ready to be written to.
-
getDeadline
public long getDeadline()- Specified by:
getDeadline
in interfaceSelectable
- 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 asSystem.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 bySelectable.isReading()
.- Specified by:
setReading
in interfaceSelectable
-
setWriting
public void setWriting(boolean writing) Description copied from interface:Selectable
Sets the value that will be returned bySelectable.isWriting()
.- Specified by:
setWriting
in interfaceSelectable
-
setDeadline
public void setDeadline(long deadline) Description copied from interface:Selectable
Sets the value that will be returned bySelectable.getDeadline()
.- Specified by:
setDeadline
in interfaceSelectable
-
onReadable
Description copied from interface:Selectable
Registers a callback that will be run when the selectable becomes ready for reading.- Specified by:
onReadable
in interfaceSelectable
- Parameters:
runnable
- the callback to register. Any previously registered callback will be replaced.
-
onWritable
Description copied from interface:Selectable
Registers a callback that will be run when the selectable becomes ready for writing.- Specified by:
onWritable
in interfaceSelectable
- Parameters:
runnable
- the callback to register. Any previously registered callback will be replaced.
-
onExpired
Description copied from interface:Selectable
Registers a callback that will be run when the selectable expires.- Specified by:
onExpired
in interfaceSelectable
- Parameters:
runnable
- the callback to register. Any previously registered callback will be replaced.
-
onError
Description copied from interface:Selectable
Registers a callback that will be run when the selectable is notified of an error.- Specified by:
onError
in interfaceSelectable
- Parameters:
runnable
- the callback to register. Any previously registered callback will be replaced.
-
onRelease
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 interfaceSelectable
- Parameters:
runnable
- the callback to register. Any previously registered callback will be replaced.
-
onFree
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 interfaceSelectable
- 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 underlyingSelectableChannel
is ready for a read operation.- Specified by:
readable
in interfaceSelectable
-
writeable
public void writeable()Description copied from interface:Selectable
Notify the selectable that the underlyingSelectableChannel
is ready for a write operation.- Specified by:
writeable
in interfaceSelectable
-
expired
public void expired()Description copied from interface:Selectable
Notify the selectable that it has expired.- Specified by:
expired
in interfaceSelectable
-
error
public void error()Description copied from interface:Selectable
Notify the selectable that an error has occurred.- Specified by:
error
in interfaceSelectable
-
release
public void release()Description copied from interface:Selectable
Notify the selectable that it has been released.- Specified by:
release
in interfaceSelectable
-
free
public void free()Description copied from interface:Selectable
Notify the selectable that it has been free'd.- Specified by:
free
in interfaceReactorChild
- Specified by:
free
in interfaceSelectable
-
setChannel
Description copied from interface:Selectable
Associates aSelectableChannel
with this selector.- Specified by:
setChannel
in interfaceSelectable
-
getChannel
- Specified by:
getChannel
in interfaceSelectable
- 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 interfaceSelectable
- 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 interfaceSelectable
- Parameters:
registered
- the value returned bySelectable.isRegistered()
-
setCollector
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 interfaceSelectable
-
getReactor
- Specified by:
getReactor
in interfaceSelectable
- 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 interfaceSelectable
-
isTerminal
public boolean isTerminal()- Specified by:
isTerminal
in interfaceSelectable
- Returns:
true
if the selectable has reached a terminal state.
-
getTransport
-
setTransport
-
setReactor
-
attachments
- Specified by:
attachments
in interfaceExtendable
-
isTerminated
public boolean isTerminated() -
terminated
public void terminated()
-