List of usage examples for io.netty.util.internal ObjectUtil checkNotNull
public static <T> T checkNotNull(T arg, String text)
From source file:com.chat.common.netty.handler.encode.LengthFieldPrepender.java
License:Apache License
/** * Creates a new instance.//w w w . j a v a2 s . com * * @param byteOrder the {@link ByteOrder} of the length field * @param lengthFieldLength the length of the prepended length field. * Only 1, 2, 3, 4, and 8 are allowed. * @param lengthAdjustment the compensation value to add to the value * of the length field * @param lengthIncludesLengthFieldLength * if {@code true}, the length of the prepended * length field is added to the value of the * prepended length field. * * @throws IllegalArgumentException * if {@code lengthFieldLength} is not 1, 2, 3, 4, or 8 */ public LengthFieldPrepender(ByteOrder byteOrder, int lengthFieldLength, int lengthAdjustment, boolean lengthIncludesLengthFieldLength) { if (lengthFieldLength != 1 && lengthFieldLength != 2 && lengthFieldLength != 3 && lengthFieldLength != 4 && lengthFieldLength != 8) { throw new IllegalArgumentException( "lengthFieldLength must be either 1, 2, 3, 4, or 8: " + lengthFieldLength); } ObjectUtil.checkNotNull(byteOrder, "byteOrder"); this.byteOrder = byteOrder; this.lengthFieldLength = lengthFieldLength; this.lengthIncludesLengthFieldLength = lengthIncludesLengthFieldLength; this.lengthAdjustment = lengthAdjustment; }
From source file:com.linkedin.r2.transport.http.client.Http2AlpnHandler.java
License:Apache License
public Http2AlpnHandler(SslHandler sslHandler, Http2StreamCodec http2Handler) { ObjectUtil.checkNotNull(sslHandler, "sslHandler"); ObjectUtil.checkNotNull(http2Handler, "http2Handler"); _sslHandler = sslHandler;/* ww w. j av a 2 s . c o m*/ _http2Handler = http2Handler; }
From source file:com.linkedin.r2.transport.http.client.Http2StreamCodecBuilder.java
License:Apache License
public Http2StreamCodecBuilder scheduler(ScheduledExecutorService scheduler) { ObjectUtil.checkNotNull(scheduler, "scheduler"); _scheduler = scheduler; return self(); }
From source file:com.linkedin.r2.transport.http.client.Http2StreamCodecBuilder.java
License:Apache License
@Override public Http2StreamCodecBuilder connection(Http2Connection connection) { ObjectUtil.checkNotNull(connection, "connection"); _connection = connection;/*from w ww . j a v a 2 s . c o m*/ return self(); }
From source file:com.linkedin.r2.transport.http.client.Http2StreamCodecBuilder.java
License:Apache License
@Override public Http2StreamCodec build() { ObjectUtil.checkNotNull(_connection, "connection"); ObjectUtil.checkPositive(_maxHeaderSize, "maxHeaderSize"); Http2HeadersDecoder headerDecoder = new DefaultHttp2HeadersDecoder(_maxHeaderSize, Http2CodecUtil.DEFAULT_HEADER_TABLE_SIZE, isValidateHeaders(), INITIAL_HUFFMAN_DECODE_CAPACITY); Http2FrameReader reader = new DefaultHttp2FrameReader(headerDecoder); Http2FrameWriter writer = new DefaultHttp2FrameWriter(headerSensitivityDetector()); if (frameLogger() != null) { reader = new Http2InboundFrameLogger(reader, frameLogger()); writer = new Http2OutboundFrameLogger(writer, frameLogger()); }//from w ww . ja v a 2 s . c om Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(_connection, writer); boolean encoderEnforceMaxConcurrentStreams = encoderEnforceMaxConcurrentStreams(); if (encoderEnforceMaxConcurrentStreams) { if (_connection.isServer()) { encoder.close(); reader.close(); throw new IllegalArgumentException("encoderEnforceMaxConcurrentStreams: " + encoderEnforceMaxConcurrentStreams + " not supported for server"); } encoder = new StreamBufferingEncoder(encoder); } Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(_connection, encoder, reader); super.codec(decoder, encoder); return super.build(); }
From source file:com.linkedin.r2.transport.http.client.Http2StreamCodecBuilder.java
License:Apache License
@Override protected Http2StreamCodec build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings) throws Exception { ObjectUtil.checkPositive(_maxContentLength, "maxContentLength"); ObjectUtil.checkPositive(_gracefulShutdownTimeoutMillis, "gracefulShutdownTimeoutMillis"); ObjectUtil.checkNotNull(_scheduler, "scheduler"); ObjectUtil.checkNotNull(_connection, "connection"); Http2StreamCodec codec = new Http2StreamCodec(decoder, encoder, initialSettings); super.frameListener( new Http2FrameListener(_scheduler, _connection, codec, _maxContentLength, _streamingTimeout)); super.gracefulShutdownTimeoutMillis(_gracefulShutdownTimeoutMillis); return codec; }
From source file:io.netty.example.spdy.client.SpdyFrameLogger.java
License:Apache License
public SpdyFrameLogger(InternalLogLevel level) { this.level = ObjectUtil.checkNotNull(level, "level"); this.logger = InternalLoggerFactory.getInstance(getClass()); }
From source file:shi.proto.header.MqttFixedHeader.java
License:Apache License
public MqttFixedHeader(MqttMessageType messageType, boolean isDup, MqttQoS qosLevel, boolean isRetain, int remainingLength) { this.messageType = ObjectUtil.checkNotNull(messageType, "messageType"); this.isDup = isDup; this.qosLevel = ObjectUtil.checkNotNull(qosLevel, "qosLevel"); this.isRetain = isRetain; this.remainingLength = remainingLength; }