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 TypeMethodDescriptionvoiderror()Notify the selectable that an error has occurred.voidexpired()Notify the selectable that it has expired.voidfree()Notify the selectable that it has been free'd.longprotected TransportbooleanbooleanCheck if a selectable is registered.booleanbooleanbooleanvoidonError(Selectable.Callback runnable) Registers a callback that will be run when the selectable is notified of an error.voidonExpired(Selectable.Callback runnable) Registers a callback that will be run when the selectable expires.voidonFree(Selectable.Callback runnable) Registers a callback that will be run when the selectable is notified that it has been free'd.voidonReadable(Selectable.Callback runnable) Registers a callback that will be run when the selectable becomes ready for reading.voidonRelease(Selectable.Callback runnable) Registers a callback that will be run when the selectable is notified that it has been released.voidonWritable(Selectable.Callback runnable) Registers a callback that will be run when the selectable becomes ready for writing.voidreadable()Notify the selectable that the underlyingSelectableChannelis ready for a read operation.voidrelease()Notify the selectable that it has been released.voidsetChannel(SelectableChannel channel) Associates aSelectableChannelwith this selector.voidsetCollector(Collector collector) Configure a selectable with a set of callbacks that emit readable, writable, and expired events into the supplied collector.voidsetDeadline(long deadline) Sets the value that will be returned bySelectable.getDeadline().protected voidsetReactor(Reactor reactor) voidsetReading(boolean reading) Sets the value that will be returned bySelectable.isReading().voidsetRegistered(boolean registered) Set the registered flag for a selectable.protected voidsetTransport(Transport transport) voidsetWriting(boolean writing) Sets the value that will be returned bySelectable.isWriting().voidTerminates the selectable.voidvoidNotify the selectable that the underlyingSelectableChannelis ready for a write operation.
-
Constructor Details
-
SelectableImpl
public SelectableImpl()
-
-
Method Details
-
isReading
public boolean isReading()- Specified by:
isReadingin interfaceSelectable- Returns:
trueif the selectable is interested in receiving notification (via theSelectable.readable()method that indicate that the associatedSelectableChannelhas data ready to be read from it.
-
isWriting
public boolean isWriting()- Specified by:
isWritingin interfaceSelectable- Returns:
trueif the selectable is interested in receiving notifications (via theSelectable.writeable()method that indicate that the associatedSelectableChannelis ready to be written to.
-
getDeadline
public long getDeadline()- Specified by:
getDeadlinein 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:SelectableSets the value that will be returned bySelectable.isReading().- Specified by:
setReadingin interfaceSelectable
-
setWriting
public void setWriting(boolean writing) Description copied from interface:SelectableSets the value that will be returned bySelectable.isWriting().- Specified by:
setWritingin interfaceSelectable
-
setDeadline
public void setDeadline(long deadline) Description copied from interface:SelectableSets the value that will be returned bySelectable.getDeadline().- Specified by:
setDeadlinein interfaceSelectable
-
onReadable
Description copied from interface:SelectableRegisters a callback that will be run when the selectable becomes ready for reading.- Specified by:
onReadablein interfaceSelectable- Parameters:
runnable- the callback to register. Any previously registered callback will be replaced.
-
onWritable
Description copied from interface:SelectableRegisters a callback that will be run when the selectable becomes ready for writing.- Specified by:
onWritablein interfaceSelectable- Parameters:
runnable- the callback to register. Any previously registered callback will be replaced.
-
onExpired
Description copied from interface:SelectableRegisters a callback that will be run when the selectable expires.- Specified by:
onExpiredin interfaceSelectable- Parameters:
runnable- the callback to register. Any previously registered callback will be replaced.
-
onError
Description copied from interface:SelectableRegisters a callback that will be run when the selectable is notified of an error.- Specified by:
onErrorin interfaceSelectable- Parameters:
runnable- the callback to register. Any previously registered callback will be replaced.
-
onRelease
Description copied from interface:SelectableRegisters a callback that will be run when the selectable is notified that it has been released.- Specified by:
onReleasein interfaceSelectable- Parameters:
runnable- the callback to register. Any previously registered callback will be replaced.
-
onFree
Description copied from interface:SelectableRegisters a callback that will be run when the selectable is notified that it has been free'd.- Specified by:
onFreein interfaceSelectable- Parameters:
runnable- the callback to register. Any previously registered callback will be replaced.
-
readable
public void readable()Description copied from interface:SelectableNotify the selectable that the underlyingSelectableChannelis ready for a read operation.- Specified by:
readablein interfaceSelectable
-
writeable
public void writeable()Description copied from interface:SelectableNotify the selectable that the underlyingSelectableChannelis ready for a write operation.- Specified by:
writeablein interfaceSelectable
-
expired
public void expired()Description copied from interface:SelectableNotify the selectable that it has expired.- Specified by:
expiredin interfaceSelectable
-
error
public void error()Description copied from interface:SelectableNotify the selectable that an error has occurred.- Specified by:
errorin interfaceSelectable
-
release
public void release()Description copied from interface:SelectableNotify the selectable that it has been released.- Specified by:
releasein interfaceSelectable
-
free
public void free()Description copied from interface:SelectableNotify the selectable that it has been free'd.- Specified by:
freein interfaceReactorChild- Specified by:
freein interfaceSelectable
-
setChannel
Description copied from interface:SelectableAssociates aSelectableChannelwith this selector.- Specified by:
setChannelin interfaceSelectable
-
getChannel
- Specified by:
getChannelin interfaceSelectable- Returns:
- the
SelectableChannelassociated with this selector.
-
isRegistered
public boolean isRegistered()Description copied from interface:SelectableCheck 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:
isRegisteredin interfaceSelectable- Returns:
trueif the selectable is registered.
-
setRegistered
public void setRegistered(boolean registered) Description copied from interface:SelectableSet the registered flag for a selectable.Note: the reactor code, currently, does not use this flag.
- Specified by:
setRegisteredin interfaceSelectable- Parameters:
registered- the value returned bySelectable.isRegistered()
-
setCollector
Description copied from interface:SelectableConfigure a selectable with a set of callbacks that emit readable, writable, and expired events into the supplied collector.- Specified by:
setCollectorin interfaceSelectable
-
getReactor
- Specified by:
getReactorin interfaceSelectable- Returns:
- the reactor to which this selectable is a child.
-
terminate
public void terminate()Description copied from interface:SelectableTerminates the selectable. Once a selectable reaches a terminal state it will never be interested in events of any kind.- Specified by:
terminatein interfaceSelectable
-
isTerminal
public boolean isTerminal()- Specified by:
isTerminalin interfaceSelectable- Returns:
trueif the selectable has reached a terminal state.
-
getTransport
-
setTransport
-
setReactor
-
attachments
- Specified by:
attachmentsin interfaceExtendable
-
isTerminated
public boolean isTerminated() -
terminated
public void terminated()
-