Interface Callback

All Superinterfaces:
Invocable
All Known Implementing Classes:
Callback.Completable, Callback.Completing, Callback.Nested, CompletableCallback, CountingCallback, DeferredContentProvider, FutureCallback, HttpContent, HttpDestination, HttpDestinationOverHTTP, HttpInput.Content, HttpInput.EofContent, HttpInput.SentinelContent, InputStreamContentProvider, IteratingCallback, IteratingNestedCallback, MultiplexHttpDestination, OutputStreamContentProvider, PoolingHttpDestination, SharedBlockingCallback.Blocker

@Deprecated(since="2021-05-27") public interface Callback extends Invocable
Deprecated.
The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.

A callback abstraction that handles completed/failed events of asynchronous operations.

Semantically this is equivalent to an optimise Promise<Void>, but callback is a more meaningful name than EmptyPromise

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Deprecated.
    The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
    static class 
    Deprecated.
    static class 
    Deprecated.
    The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable

    Invocable.InvocationType
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Callback
    Deprecated.
    Instance of Adapter that can be used when the callback methods need an empty implementation without incurring in the cost of allocating a new Adapter object.

    Fields inherited from interface org.eclipse.jetty.util.thread.Invocable

    __nonBlocking
  • Method Summary

    Modifier and Type
    Method
    Description
    static Callback
    Deprecated.
     
    default void
    Deprecated.
    Callback invoked when the operation fails.
    static Callback
    from(Runnable completed)
    Deprecated.
    Creaste a callback that runs completed when it succeeds or fails
    static Callback
    from(Runnable success, Consumer<Throwable> failure)
    Deprecated.
    Creates a callback from the given success and failure lambdas.
    static Callback
    from(Runnable completed, Callback callback)
    Deprecated.
    Create a nested callback that runs completed before completing the nested callback.
    static Callback
    from(CompletableFuture<?> completable)
    Deprecated.
    Creates a non-blocking callback from the given incomplete CompletableFuture.
    static Callback
    from(CompletableFuture<?> completable, Invocable.InvocationType invocation)
    Deprecated.
    Creates a callback from the given incomplete CompletableFuture, with the given blocking characteristic.
    static Callback
    from(Callback callback, Runnable completed)
    Deprecated.
    Create a nested callback that runs completed after completing the nested callback.
    static Callback
    from(Invocable.InvocationType invocationType, Runnable success, Consumer<Throwable> failure)
    Deprecated.
    Creates a callback with the given InvocationType from the given success and failure lambdas.
    default void
    Deprecated.
    Callback invoked when the operation completes.

    Methods inherited from interface org.eclipse.jetty.util.thread.Invocable

    getInvocationType
  • Field Details

    • NOOP

      static final Callback NOOP
      Deprecated.
      Instance of Adapter that can be used when the callback methods need an empty implementation without incurring in the cost of allocating a new Adapter object.
  • Method Details

    • succeeded

      default void succeeded()
      Deprecated.

      Callback invoked when the operation completes.

      See Also:
    • failed

      default void failed(Throwable x)
      Deprecated.

      Callback invoked when the operation fails.

      Parameters:
      x - the reason for the operation failure
    • from

      static Callback from(CompletableFuture<?> completable)
      Deprecated.

      Creates a non-blocking callback from the given incomplete CompletableFuture.

      When the callback completes, either succeeding or failing, the CompletableFuture is also completed, respectively via CompletableFuture.complete(Object) or CompletableFuture.completeExceptionally(Throwable).

      Parameters:
      completable - the CompletableFuture to convert into a callback
      Returns:
      a callback that when completed, completes the given CompletableFuture
    • from

      static Callback from(CompletableFuture<?> completable, Invocable.InvocationType invocation)
      Deprecated.

      Creates a callback from the given incomplete CompletableFuture, with the given blocking characteristic.

      Parameters:
      completable - the CompletableFuture to convert into a callback
      invocation - whether the callback is blocking
      Returns:
      a callback that when completed, completes the given CompletableFuture
    • from

      static Callback from(Runnable success, Consumer<Throwable> failure)
      Deprecated.
      Creates a callback from the given success and failure lambdas.
      Parameters:
      success - Called when the callback succeeds
      failure - Called when the callback fails
      Returns:
      a new Callback
    • from

      static Callback from(Invocable.InvocationType invocationType, Runnable success, Consumer<Throwable> failure)
      Deprecated.
      Creates a callback with the given InvocationType from the given success and failure lambdas.
      Parameters:
      invocationType - the Callback invocation type
      success - Called when the callback succeeds
      failure - Called when the callback fails
      Returns:
      a new Callback
    • from

      static Callback from(Runnable completed)
      Deprecated.
      Creaste a callback that runs completed when it succeeds or fails
      Parameters:
      completed - The completion to run on success or failure
      Returns:
      a new callback
    • from

      static Callback from(Callback callback, Runnable completed)
      Deprecated.
      Create a nested callback that runs completed after completing the nested callback.
      Parameters:
      callback - The nested callback
      completed - The completion to run after the nested callback is completed
      Returns:
      a new callback.
    • from

      static Callback from(Runnable completed, Callback callback)
      Deprecated.
      Create a nested callback that runs completed before completing the nested callback.
      Parameters:
      completed - The completion to run before the nested callback is completed. Any exceptions thrown from completed will result in a callback failure.
      callback - The nested callback
      Returns:
      a new callback.
    • combine

      static Callback combine(Callback cb1, Callback cb2)
      Deprecated.