Class FeedableBodyGenerator.NonBlockingFeeder
java.lang.Object
com.ning.http.client.providers.grizzly.FeedableBodyGenerator.BaseFeeder
com.ning.http.client.providers.grizzly.FeedableBodyGenerator.NonBlockingFeeder
- All Implemented Interfaces:
FeedableBodyGenerator.Feeder
- Direct Known Subclasses:
NonBlockingInputStreamFeeder
- Enclosing class:
- FeedableBodyGenerator
public abstract static class FeedableBodyGenerator.NonBlockingFeeder
extends FeedableBodyGenerator.BaseFeeder
Implementations of this class provide the framework to read data from
some source and feed data to the
FeedableBodyGenerator
without blocking.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener to signal that data is available to be fed. -
Field Summary
Fields inherited from class com.ning.http.client.providers.grizzly.FeedableBodyGenerator.BaseFeeder
feedableBodyGenerator -
Constructor Summary
ConstructorsConstructorDescriptionNonBlockingFeeder(FeedableBodyGenerator feedableBodyGenerator) Constructs theNonBlockingFeederwith the associatedFeedableBodyGenerator. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcanFeed()Notification that it's possible to send another block of data viaFeedableBodyGenerator.BaseFeeder.feed(org.glassfish.grizzly.Buffer, boolean).voidflush()This method will be invoked when it's possible to begin feeding data downstream.abstract booleanisDone()abstract booleanisReady()abstract voidCallback registration to signal theFeedableBodyGeneratorthat data is available once again to continue feeding.protected booleanonFullWriteQueue(org.glassfish.grizzly.Connection c) Methods inherited from class com.ning.http.client.providers.grizzly.FeedableBodyGenerator.BaseFeeder
feed, reset
-
Constructor Details
-
NonBlockingFeeder
Constructs theNonBlockingFeederwith the associatedFeedableBodyGenerator.
-
-
Method Details
-
canFeed
Notification that it's possible to send another block of data viaFeedableBodyGenerator.BaseFeeder.feed(org.glassfish.grizzly.Buffer, boolean). It's important to only invokeFeedableBodyGenerator.BaseFeeder.feed(Buffer, boolean)once per invocation ofcanFeed().- Throws:
IOException
-
isDone
public abstract boolean isDone()- Returns:
trueif all data has been fed by this feeder, otherwise returnsfalse.
-
isReady
public abstract boolean isReady()- Returns:
trueif data is available to be fed, otherwise returnsfalse. When this method returnsfalse, theFeedableBodyGeneratorwill callnotifyReadyToFeed(ReadyToFeedListener)by which thisFeedableBodyGenerator.NonBlockingFeederimplementation may signal data is once again available to be fed.
-
notifyReadyToFeed
public abstract void notifyReadyToFeed(FeedableBodyGenerator.NonBlockingFeeder.ReadyToFeedListener listener) Callback registration to signal theFeedableBodyGeneratorthat data is available once again to continue feeding. Once this listener has been invoked, the NonBlockingFeeder implementation should no longer maintain a reference to the listener. -
flush
Description copied from interface:FeedableBodyGenerator.FeederThis method will be invoked when it's possible to begin feeding data downstream. Implementations of this method must useFeedableBodyGenerator.Feeder.feed(Buffer, boolean)to perform the actual write.- Throws:
IOException- if an I/O error occurs.
-
onFullWriteQueue
protected boolean onFullWriteQueue(org.glassfish.grizzly.Connection c)
-