io.netty.util.internal.ObjectUtil#checkNotNull ( )源码实例Demo

下面列出了io.netty.util.internal.ObjectUtil#checkNotNull ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netty4.0.27Learn   文件: OpenSslEngine.java
@Override
public void putValue(String name, Object value) {
    ObjectUtil.checkNotNull(name, "name");
    ObjectUtil.checkNotNull(value, "value");

    Map<String, Object> values = this.values;
    if (values == null) {
        // Use size of 2 to keep the memory overhead small
        values = this.values = new HashMap<String, Object>(2);
    }
    Object old = values.put(name, value);
    if (value instanceof SSLSessionBindingListener) {
        ((SSLSessionBindingListener) value).valueBound(new SSLSessionBindingEvent(this, name));
    }
    notifyUnbound(old, name);
}
 
源代码2 项目: netty-4.1.22   文件: OpenSslSessionContext.java
/**
 * Sets the SSL session ticket keys of this context.设置此上下文的SSL会话票据密钥。
 */
public void setTicketKeys(OpenSslSessionTicketKey... keys) {
    ObjectUtil.checkNotNull(keys, "keys");
    SessionTicketKey[] ticketKeys = new SessionTicketKey[keys.length];
    for (int i = 0; i < ticketKeys.length; i++) {
        ticketKeys[i] = keys[i].key;
    }
    Lock writerLock = context.ctxLock.writeLock();
    writerLock.lock();
    try {
        SSLContext.clearOptions(context.ctx, SSL.SSL_OP_NO_TICKET);
        SSLContext.setSessionTicketKeys(context.ctx, ticketKeys);
    } finally {
        writerLock.unlock();
    }
}
 
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
    ObjectUtil.checkNotNull(command, "command");
    ObjectUtil.checkNotNull(unit, "unit");
    if (initialDelay < 0) {
        throw new IllegalArgumentException(
                String.format("initialDelay: %d (expected: >= 0)", initialDelay));
    }
    if (period <= 0) {
        throw new IllegalArgumentException(
                String.format("period: %d (expected: > 0)", period));
    }

    return schedule(new ScheduledFutureTask<Void>(
            this, Executors.<Void>callable(command, null),
            ScheduledFutureTask.deadlineNanos(unit.toNanos(initialDelay)), unit.toNanos(period)));
}
 
源代码4 项目: netty-4.1.22   文件: DnsNameResolverContext.java
DnsNameResolverContext(DnsNameResolver parent,
                       String hostname,
                       DnsRecord[] additionals,
                       DnsCache resolveCache,
                       DnsServerAddressStream nameServerAddrs) {
    this.parent = parent;
    this.hostname = hostname;
    this.additionals = additionals;
    this.resolveCache = resolveCache;

    this.nameServerAddrs = ObjectUtil.checkNotNull(nameServerAddrs, "nameServerAddrs");
    maxAllowedQueries = parent.maxQueriesPerResolve();
    resolvedInternetProtocolFamilies = parent.resolvedInternetProtocolFamiliesUnsafe();
    allowedQueries = maxAllowedQueries;
}
 
源代码5 项目: kcp-netty   文件: UkcpServerBootstrap.java
/**
 * Set the specific {@link AttributeKey} with the given value on every child {@link Channel}. If the value is
 * {@code null} the {@link AttributeKey} is removed
 */
public <T> UkcpServerBootstrap childAttr(AttributeKey<T> childKey, T value) {
    ObjectUtil.checkNotNull(childKey, "childKey");
    if (value == null) {
        childAttrs.remove(childKey);
    } else {
        childAttrs.put(childKey, value);
    }
    return this;
}
 
源代码6 项目: netty-4.1.22   文件: UnaryPromiseNotifier.java
public UnaryPromiseNotifier(Promise<? super T> promise) {
    this.promise = ObjectUtil.checkNotNull(promise, "promise");
}
 
源代码7 项目: netty-4.1.22   文件: PemPrivateKey.java
private PemPrivateKey(ByteBuf content) {
    this.content = ObjectUtil.checkNotNull(content, "content");
}
 
源代码8 项目: netty-4.1.22   文件: AbstractBootstrapConfig.java
protected AbstractBootstrapConfig(B bootstrap) {
    this.bootstrap = ObjectUtil.checkNotNull(bootstrap, "bootstrap");
}
 
源代码9 项目: netty-4.1.22   文件: LineSeparator.java
/**
 * Create {@link LineSeparator} with the specified {@code lineSeparator} string.
 */
public LineSeparator(String lineSeparator) {
    this.value = ObjectUtil.checkNotNull(lineSeparator, "lineSeparator");
}
 
源代码10 项目: netty-4.1.22   文件: DnsNameResolverException.java
private static DnsQuestion validateQuestion(DnsQuestion question) {
    return ObjectUtil.checkNotNull(question, "question");
}
 
UniSequentialDnsServerAddressStreamProvider(DnsServerAddresses addresses) {
    this.addresses = ObjectUtil.checkNotNull(addresses, "addresses");
}
 
源代码12 项目: netty-4.1.22   文件: DefaultHttp2SettingsFrame.java
public DefaultHttp2SettingsFrame(Http2Settings settings) {
    this.settings = ObjectUtil.checkNotNull(settings, "settings");
}
 
源代码13 项目: netty-4.1.22   文件: Http2StreamChannelBootstrap.java
public Http2StreamChannelBootstrap(Channel channel) {
    this.channel = ObjectUtil.checkNotNull(channel, "channel");
}
 
源代码14 项目: netty-4.1.22   文件: DefaultSmtpRequest.java
DefaultSmtpRequest(SmtpCommand command, List<CharSequence> parameters) {
    this.command = ObjectUtil.checkNotNull(command, "command");
    this.parameters = parameters != null ?
            Collections.unmodifiableList(parameters) : Collections.<CharSequence>emptyList();
}
 
源代码15 项目: netty-4.1.22   文件: PemValue.java
public PemValue(ByteBuf content, boolean sensitive) {
    this.content = ObjectUtil.checkNotNull(content, "content");
    this.sensitive = sensitive;
}
 
源代码16 项目: netty-4.1.22   文件: PromiseCombiner.java
/**
 * <p>Sets the promise to be notified when all combined futures have finished. If all combined futures succeed,
 * then the aggregate promise will succeed. If one or more combined futures fails, then the aggregate promise will
 * fail with the cause of one of the failed futures. If more than one combined future fails, then exactly which
 * failure will be assigned to the aggregate promise is undefined.</p>
 *
 * <p>After this method is called, no more futures may be added via the {@link PromiseCombiner#add(Future)} or
 * {@link PromiseCombiner#addAll(Future[])} methods.</p>
 *
 * @param aggregatePromise the promise to notify when all combined futures have finished
 *                         设定所有组合期货交易完成后的通知。如果所有联合期货都成功,那么总的承诺将成功。如果一个或多个联合期货失败,那么总的承诺将会因为其中一个失败期货的原因而失败。如果不止一个组合的未来失败,那么将分配给聚合承诺的具体失败是不确定的。
在调用此方法之后,不再可以通过add(Future)或addAll(Future)方法添加未来。
 */
public void finish(Promise<Void> aggregatePromise) {
    if (doneAdding) {
        throw new IllegalStateException("Already finished");
    }
    doneAdding = true;
    this.aggregatePromise = ObjectUtil.checkNotNull(aggregatePromise, "aggregatePromise");
    if (doneCount == expectedCount) {
        tryPromise();
    }
}
 
源代码17 项目: netty-4.1.22   文件: RedisEncoder.java
/**
 * Creates a new instance.
 * @param messagePool the predefined message pool.
 */
public RedisEncoder(RedisMessagePool messagePool) {
    this.messagePool = ObjectUtil.checkNotNull(messagePool, "messagePool");
}
 
源代码18 项目: netty-4.1.22   文件: WebSocketChunkedInput.java
/**
 * Creates a new instance using the specified input.
 * @param input {@link ChunkedInput} containing data to write
 * @param rsv RSV1, RSV2, RSV3 used for extensions
 *
 * @throws  NullPointerException if {@code input} is null
 */
public WebSocketChunkedInput(ChunkedInput<ByteBuf> input, int rsv) {
    this.input = ObjectUtil.checkNotNull(input, "input");
    this.rsv = rsv;
}
 
源代码19 项目: netty-4.1.22   文件: SniHandler.java
/**
 * Creates a SNI detection handler with configured {@link SslContext}
 * maintained by {@link AsyncMapping}
 * 使用配置的SslContext创建一个SNI检测处理程序,由异步映射维护
 *
 * @param mapping the mapping of domain name to {@link SslContext}
 */
@SuppressWarnings("unchecked")
public SniHandler(AsyncMapping<? super String, ? extends SslContext> mapping) {
    this.mapping = (AsyncMapping<String, SslContext>) ObjectUtil.checkNotNull(mapping, "mapping");
}
 
/**
 * Creates a new instance with the specified fallback protocol name.使用指定的回退协议名称创建一个新实例。
 *
 * @param fallbackProtocol the name of the protocol to use when
 *                         ALPN/NPN negotiation fails or the client does not support ALPN/NPN
 */
protected ApplicationProtocolNegotiationHandler(String fallbackProtocol) {
    this.fallbackProtocol = ObjectUtil.checkNotNull(fallbackProtocol, "fallbackProtocol");
}