Package io.netty.channel
Class ChannelFlushPromiseNotifier
java.lang.Object
io.netty.channel.ChannelFlushPromiseNotifier
This implementation allows to register
ChannelFuture
instances which will get notified once some amount of
data was written and so a checkpoint was reached.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
(package private) static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Queue
<ChannelFlushPromiseNotifier.FlushCheckpoint> private final boolean
private long
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance which will useChannelPromise.setSuccess()
andChannelPromise.setFailure(Throwable)
to notify theChannelPromise
s.ChannelFlushPromiseNotifier
(boolean tryNotify) Create a new instance -
Method Summary
Modifier and TypeMethodDescriptionadd
(ChannelPromise promise, int pendingDataSize) Deprecated.add
(ChannelPromise promise, long pendingDataSize) Add aChannelPromise
to thisChannelFlushPromiseNotifier
which will be notified after the givenpendingDataSize
was reached.increaseWriteCounter
(long delta) Increase the current write counter by the given deltaDeprecated.usenotifyPromises()
notifyFlushFutures
(Throwable cause) Deprecated.notifyFlushFutures
(Throwable cause1, Throwable cause2) Deprecated.Notify allChannelFuture
s that were registered withadd(ChannelPromise, int)
and their pendingDatasize is smaller after the current writeCounter returned bywriteCounter()
.notifyPromises
(Throwable cause) Notify allChannelFuture
s that were registered withadd(ChannelPromise, int)
and their pendingDatasize isis smaller then the current writeCounter returned bywriteCounter()
.notifyPromises
(Throwable cause1, Throwable cause2) Notify allChannelFuture
s that were registered withadd(ChannelPromise, int)
and their pendingDatasize is smaller then the current writeCounter returned bywriteCounter()
using the given cause1.private void
notifyPromises0
(Throwable cause) long
Return the current write counter of thisChannelFlushPromiseNotifier
-
Field Details
-
writeCounter
private long writeCounter -
flushCheckpoints
-
tryNotify
private final boolean tryNotify
-
-
Constructor Details
-
ChannelFlushPromiseNotifier
public ChannelFlushPromiseNotifier(boolean tryNotify) Create a new instance- Parameters:
tryNotify
- iftrue
theChannelPromise
s will get notified withChannelPromise.trySuccess()
andPromise.tryFailure(Throwable)
. OtherwiseChannelPromise.setSuccess()
andChannelPromise.setFailure(Throwable)
is used
-
ChannelFlushPromiseNotifier
public ChannelFlushPromiseNotifier()Create a new instance which will useChannelPromise.setSuccess()
andChannelPromise.setFailure(Throwable)
to notify theChannelPromise
s.
-
-
Method Details
-
add
Deprecated. -
add
Add aChannelPromise
to thisChannelFlushPromiseNotifier
which will be notified after the givenpendingDataSize
was reached. -
increaseWriteCounter
Increase the current write counter by the given delta -
writeCounter
public long writeCounter()Return the current write counter of thisChannelFlushPromiseNotifier
-
notifyPromises
Notify allChannelFuture
s that were registered withadd(ChannelPromise, int)
and their pendingDatasize is smaller after the current writeCounter returned bywriteCounter()
. After aChannelFuture
was notified it will be removed from thisChannelFlushPromiseNotifier
and so not receive anymore notification. -
notifyFlushFutures
Deprecated.usenotifyPromises()
-
notifyPromises
Notify allChannelFuture
s that were registered withadd(ChannelPromise, int)
and their pendingDatasize isis smaller then the current writeCounter returned bywriteCounter()
. After aChannelFuture
was notified it will be removed from thisChannelFlushPromiseNotifier
and so not receive anymore notification. The rest of the remainingChannelFuture
s will be failed with the givenThrowable
. So after this operation thisChannelFutureListener
is empty. -
notifyFlushFutures
Deprecated. -
notifyPromises
Notify allChannelFuture
s that were registered withadd(ChannelPromise, int)
and their pendingDatasize is smaller then the current writeCounter returned bywriteCounter()
using the given cause1. After aChannelFuture
was notified it will be removed from thisChannelFlushPromiseNotifier
and so not receive anymore notification. The rest of the remainingChannelFuture
s will be failed with the givenThrowable
. So after this operation thisChannelFutureListener
is empty.- Parameters:
cause1
- theThrowable
which will be used to fail all of theChannelFuture
s which pendingDataSize is smaller then the current writeCounter returned bywriteCounter()
cause2
- theThrowable
which will be used to fail the remainingChannelFuture
s
-
notifyFlushFutures
@Deprecated public ChannelFlushPromiseNotifier notifyFlushFutures(Throwable cause1, Throwable cause2) Deprecated. -
notifyPromises0
-
add(ChannelPromise, long)