Package org.eclipse.jetty.util
Class CountingCallback
- java.lang.Object
-
- org.eclipse.jetty.util.Callback.Completing
-
- org.eclipse.jetty.util.Callback.Nested
-
- org.eclipse.jetty.util.CountingCallback
-
@Deprecated(since="2021-05-27") public class CountingCallback extends Callback.Nested
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.A callback wrapper that succeeds the wrapped callback when the count is reached, or on first failure.
This callback is particularly useful when an async operation is split into multiple parts, for example when an original byte buffer that needs to be written, along with a callback, is split into multiple byte buffers, since it allows the original callback to be wrapped and notified only when the last part has been processed.
Example:
public void process(EndPoint endPoint, ByteBuffer buffer, Callback callback) { ByteBuffer[] buffers = split(buffer); CountCallback countCallback = new CountCallback(callback, buffers.length); endPoint.write(countCallback, buffers); }
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.Nested
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.InvocationType
-
-
Field Summary
-
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
-
Constructor Summary
Constructors Constructor Description CountingCallback(Callback callback, int count)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
failed(java.lang.Throwable failure)
Deprecated.Callback invoked when the operation fails.void
succeeded()
Deprecated.Callback invoked when the operation completes.java.lang.String
toString()
Deprecated.-
Methods inherited from class org.eclipse.jetty.util.Callback.Nested
getCallback, getInvocationType
-
Methods inherited from class org.eclipse.jetty.util.Callback.Completing
completed
-
-
-
-
Constructor Detail
-
CountingCallback
public CountingCallback(Callback callback, int count)
Deprecated.
-
-
Method Detail
-
succeeded
public void succeeded()
Deprecated.Description copied from interface:Callback
Callback invoked when the operation completes.
- Specified by:
succeeded
in interfaceCallback
- Overrides:
succeeded
in classCallback.Nested
- See Also:
Callback.failed(Throwable)
-
failed
public void failed(java.lang.Throwable failure)
Deprecated.Description copied from interface:Callback
Callback invoked when the operation fails.
- Specified by:
failed
in interfaceCallback
- Overrides:
failed
in classCallback.Nested
- Parameters:
failure
- the reason for the operation failure
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classjava.lang.Object
-
-