Top Description Fields Constructors Methods
org.eclipse.jetty.io

public abstract Class FillInterest

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.channels.ClosedChannelException, .ReadPendingException, java.util.concurrent.atomic.AtomicReference, org.eclipse.jetty.util.Callback, org.eclipse.jetty.util.thread.Invocable.InvocationType, org.slf4j.Logger, .LoggerFactory

A Utility class to help implement EndPoint#fillInterested(Callback) by keeping state and calling the context and callback objects.

Field Summary

Modifier and TypeField and Description
private final AtomicReference<Callback>
private static final Logger

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether the callback was notified that a read is now possible
fillable
()

Call to signal that a read is now possible.

public Invocable.InvocationType
public boolean
isInterested()

Returns: True if a read callback has been registered

protected abstract void
needsFillInterest()

Register the read interest Abstract method to be implemented by the Specific ReadInterest to schedule a future call to fillable() or onFail(Throwable)

public void
public boolean

Returns:

true if the cause was passed to a Callback instance
onFail
(Throwable
the cause of the failure
cause
)

Call to signal a failure to a registered interest

public void
register(Callback
the callback to register
callback
)

Call to register interest in a callback when a read is possible.

public String
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean

Returns:

true if the register succeeded
tryRegister
(Callback
the callback to register
callback
)

Call to register interest in a callback when a read is possible.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_interestedback to summary
private final AtomicReference<Callback> _interested
LOGback to summary
private static final Logger LOG

Constructor Detail

FillInterestback to summary
protected FillInterest()

Method Detail

fillableback to summary
public boolean fillable()

Call to signal that a read is now possible.

Returns:boolean

whether the callback was notified that a read is now possible

getCallbackInvocationTypeback to summary
public Invocable.InvocationType getCallbackInvocationType()
isInterestedback to summary
public boolean isInterested()
Returns:boolean

True if a read callback has been registered

needsFillInterestback to summary
protected abstract void needsFillInterest() throws IOException

Register the read interest Abstract method to be implemented by the Specific ReadInterest to schedule a future call to fillable() or onFail(Throwable)

Exceptions
IOException:
if unable to fulfill interest in fill
onCloseback to summary
public void onClose()
onFailback to summary
public boolean onFail(Throwable cause)

Call to signal a failure to a registered interest

Parameters
cause:Throwable

the cause of the failure

Returns:boolean

true if the cause was passed to a Callback instance

registerback to summary
public void register(Callback callback) throws ReadPendingException

Call to register interest in a callback when a read is possible. The callback will be called either immediately if needsFillInterest() returns true or eventually once fillable() is called.

Parameters
callback:Callback

the callback to register

Exceptions
ReadPendingException:
if unable to read due to pending read op
toStateStringback to summary
public String toStateString()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
tryRegisterback to summary
public boolean tryRegister(Callback callback)

Call to register interest in a callback when a read is possible. The callback will be called either immediately if needsFillInterest() returns true or eventually once fillable() is called.

Parameters
callback:Callback

the callback to register

Returns:boolean

true if the register succeeded