Home / Class/ UnaryPromiseNotifier Class — netty Architecture

UnaryPromiseNotifier Class — netty Architecture

Architecture documentation for the UnaryPromiseNotifier class in UnaryPromiseNotifier.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ee4619b3_07f7_4a65_cc8a_746ea69e60d9["UnaryPromiseNotifier"]
  6751e71c_1503_3280_d129_5d58b19268b7["UnaryPromiseNotifier.java"]
  ee4619b3_07f7_4a65_cc8a_746ea69e60d9 -->|defined in| 6751e71c_1503_3280_d129_5d58b19268b7
  87022933_d4cd_f7c9_992e_f5ed9bb21a32["UnaryPromiseNotifier()"]
  ee4619b3_07f7_4a65_cc8a_746ea69e60d9 -->|method| 87022933_d4cd_f7c9_992e_f5ed9bb21a32
  37e8df1a_bf48_8c9e_a48d_39a0687ddedd["operationComplete()"]
  ee4619b3_07f7_4a65_cc8a_746ea69e60d9 -->|method| 37e8df1a_bf48_8c9e_a48d_39a0687ddedd
  f34e4ab1_0729_13e2_0c0e_d9b472e13f9b["cascadeTo()"]
  ee4619b3_07f7_4a65_cc8a_746ea69e60d9 -->|method| f34e4ab1_0729_13e2_0c0e_d9b472e13f9b

Relationship Graph

Source Code

common/src/main/java/io/netty/util/concurrent/UnaryPromiseNotifier.java lines 26–56

@Deprecated
public final class UnaryPromiseNotifier<T> implements FutureListener<T> {
    private static final InternalLogger logger = InternalLoggerFactory.getInstance(UnaryPromiseNotifier.class);
    private final Promise<? super T> promise;

    public UnaryPromiseNotifier(Promise<? super T> promise) {
        this.promise = ObjectUtil.checkNotNull(promise, "promise");
    }

    @Override
    public void operationComplete(Future<T> future) throws Exception {
        cascadeTo(future, promise);
    }

    public static <X> void cascadeTo(Future<X> completedFuture, Promise<? super X> promise) {
        if (completedFuture.isSuccess()) {
            if (!promise.trySuccess(completedFuture.getNow())) {
                logger.warn("Failed to mark a promise as success because it is done already: {}", promise);
            }
        } else if (completedFuture.isCancelled()) {
            if (!promise.cancel(false)) {
                logger.warn("Failed to cancel a promise because it is done already: {}", promise);
            }
        } else {
            if (!promise.tryFailure(completedFuture.cause())) {
                logger.warn("Failed to mark a promise as failure because it's done already: {}", promise,
                            completedFuture.cause());
            }
        }
    }
}

Frequently Asked Questions

What is the UnaryPromiseNotifier class?
UnaryPromiseNotifier is a class in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/UnaryPromiseNotifier.java.
Where is UnaryPromiseNotifier defined?
UnaryPromiseNotifier is defined in common/src/main/java/io/netty/util/concurrent/UnaryPromiseNotifier.java at line 26.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free