Java Code Examples for io.netty.util.internal.logging.InternalLogger#warn()

The following examples show how to use io.netty.util.internal.logging.InternalLogger#warn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Http2StreamChannelBootstrap.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private static void setChannelOption(
        Channel channel, ChannelOption<?> option, Object value, InternalLogger logger) {
    try {
        if (!channel.config().setOption((ChannelOption<Object>) option, value)) {
            logger.warn("Unknown channel option '{}' for channel '{}'", option, channel);
        }
    } catch (Throwable t) {
        logger.warn(
                "Failed to set channel option '{}' with value '{}' for channel '{}'", option, value, channel, t);
    }
}
 
Example 2
Source File: AbstractBootstrap.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
    private static void setChannelOption(
            Channel channel, ChannelOption<?> option, Object value, InternalLogger logger) {
        try {
//            设置渠道配置
            if (!channel.config().setOption((ChannelOption<Object>) option, value)) {
                logger.warn("Unknown channel option '{}' for channel '{}'", option, channel);
            }
        } catch (Throwable t) {
            logger.warn(
                    "Failed to set channel option '{}' with value '{}' for channel '{}'", option, value, channel, t);
        }
    }
 
Example 3
Source File: PromiseNotificationUtil.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * Try to cancel the {@link Promise} and log if {@code logger} is not {@code null} in case this fails.如果日志记录器不为空,则尝试取消承诺和日志,以防失败。
 */
public static void tryCancel(Promise<?> p, InternalLogger logger) {
    if (!p.cancel(false) && logger != null) {
        Throwable err = p.cause();
        if (err == null) {
            logger.warn("Failed to cancel promise because it has succeeded already: {}", p);
        } else {
            logger.warn(
                    "Failed to cancel promise because it has failed already: {}, unnotified cause:",
                    p, err);
        }
    }
}
 
Example 4
Source File: PromiseNotificationUtil.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * Try to mark the {@link Promise} as success and log if {@code logger} is not {@code null} in case this fails.尝试将承诺标记为成功,如果日志记录器在失败时不为空,则记录日志。
 */
public static <V> void trySuccess(Promise<? super V> p, V result, InternalLogger logger) {
    if (!p.trySuccess(result) && logger != null) {
        Throwable err = p.cause();
        if (err == null) {
            logger.warn("Failed to mark a promise as success because it has succeeded already: {}", p);
        } else {
            logger.warn(
                    "Failed to mark a promise as success because it has failed already: {}, unnotified cause:",
                    p, err);
        }
    }
}
 
Example 5
Source File: PromiseNotificationUtil.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * Try to mark the {@link Promise} as failure and log if {@code logger} is not {@code null} in case this fails.尝试将承诺标记为失败,如果日志记录器在失败时不为空,则记录日志。
 */
public static void tryFailure(Promise<?> p, Throwable cause, InternalLogger logger) {
    if (!p.tryFailure(cause) && logger != null) {
        Throwable err = p.cause();
        if (err == null) {
            logger.warn("Failed to mark a promise as failure because it has succeeded already: {}", p, cause);
        } else {
            logger.warn(
                    "Failed to mark a promise as failure because it has failed already: {}, unnotified cause: {}",
                    p, ThrowableUtil.stackTraceToString(err), cause);
        }
    }
}