/** * Set the {@literal SETTINGS_INITIAL_WINDOW_SIZE} HTTP/2 setting * * @param initialWindowSize the new value * @return a reference to this, so the API can be used fluently */ public Http2Settings setInitialWindowSize(int initialWindowSize) { Arguments.require(initialWindowSize >= Http2CodecUtil.MIN_INITIAL_WINDOW_SIZE, "initialWindowSize must be >= " + Http2CodecUtil.MIN_INITIAL_WINDOW_SIZE); this.initialWindowSize = initialWindowSize; return this; }
/** * Set the TCP send buffer size * * @param sendBufferSize the buffers size, in bytes * @return a reference to this, so the API can be used fluently */ public NetworkOptions setSendBufferSize(int sendBufferSize) { Arguments.require(sendBufferSize > 0 || sendBufferSize == DEFAULT_SEND_BUFFER_SIZE, "sendBufferSize must be > 0"); this.sendBufferSize = sendBufferSize; return this; }
/** * set to {@code initialBufferSizeHttpDecoder} the initial buffer of the HttpDecoder. * * @param decoderInitialBufferSize the initial buffer size * @return a reference to this, so the API can be used fluently */ public HttpClientOptions setDecoderInitialBufferSize(int decoderInitialBufferSize) { Arguments.require(decoderInitialBufferSize > 0, "initialBufferSizeHttpDecoder must be > 0"); this.decoderInitialBufferSize = decoderInitialBufferSize; return this; }
/** * Set the send timeout. * * @param timeout the timeout value, in ms. * @return a reference to this, so the API can be used fluently */ public DeliveryOptions setSendTimeout(long timeout) { Arguments.require(timeout >= 1, "sendTimeout must be >= 1"); this.timeout = timeout; return this; }
/** * Flip the parser into fixed size mode, where the record size is specified by {@code size} in bytes. * <p> * This method can be called multiple times with different values of size while data is being parsed. * * @param size the new record size */ public void fixedSizeMode(int size) { Arguments.require(size > 0, "Size must be > 0"); delimited = false; recordSize = size; }
/** * Set the TCP receive buffer size * * @param receiveBufferSize the buffers size, in bytes * @return a reference to this, so the API can be used fluently */ public NetworkOptions setReceiveBufferSize(int receiveBufferSize) { Arguments.require(receiveBufferSize > 0 || receiveBufferSize == DEFAULT_RECEIVE_BUFFER_SIZE, "receiveBufferSize must be > 0"); this.receiveBufferSize = receiveBufferSize; return this; }
/** * Set the initial buffer size for the HTTP decoder * @param decoderInitialBufferSize the initial size * @return a reference to this, so the API can be used fluently */ public HttpServerOptions setDecoderInitialBufferSize(int decoderInitialBufferSize) { Arguments.require(decoderInitialBufferSize > 0, "initialBufferSizeHttpDecoder must be > 0"); this.decoderInitialBufferSize = decoderInitialBufferSize; return this; }
/** * Set the multicast ttl value * * @param multicastTimeToLive the multicast ttl value * @return a reference to this, so the API can be used fluently */ public DatagramSocketOptions setMulticastTimeToLive(int multicastTimeToLive) { Arguments.require(multicastTimeToLive >= 0, "multicastTimeToLive must be >= 0"); this.multicastTimeToLive = multicastTimeToLive; return this; }
public InboundBuffer(Context context, long highWaterMark) { Objects.requireNonNull(context, "context must not be null"); Arguments.require(highWaterMark >= 0, "highWaterMark " + highWaterMark + " >= 0"); this.context = context; this.highWaterMark = highWaterMark; this.demand = Long.MAX_VALUE; this.pending = new ArrayDeque<>(); }
@Override public Buffer getBytes(int start, int end, byte[] dst, int dstIndex) { Arguments.require(end >= start, "end must be greater or equal than start"); buffer.getBytes(start, dst, dstIndex, end - start); return this; }
@Override public synchronized AsyncFile setWriteQueueMaxSize(int maxSize) { Arguments.require(maxSize >= 2, "maxSize must be >= 2"); check(); this.maxWrites = maxSize; this.lwm = maxWrites / 2; return this; }
public byte[] getBytes(int start, int end) { Arguments.require(end >= start, "end must be greater or equal than start"); byte[] arr = new byte[end - start]; buffer.getBytes(start, arr, 0, end - start); return arr; }
@Override public ReadStream<Buffer> fetch(long amount) { Arguments.require(amount > 0, "Fetch amount must be > 0L"); demand += amount; if (demand < 0L) { demand = Long.MAX_VALUE; } return this; }
/** * Add a key as a buffer * * @param keyValue the key to add * @return a reference to this, so the API can be used fluently */ @GenIgnore public PemKeyCertOptions addKeyValue(Buffer keyValue) { Arguments.require(keyValue != null, "Null keyValue"); keyValues.add(keyValue); return this; }
/** * Add a path to a certificate file * * @param certPath the path to the certificate file * @return a reference to this, so the API can be used fluently */ @GenIgnore public PemKeyCertOptions addCertPath(String certPath) { Arguments.require(certPath != null, "Null certPath"); certPaths.add(certPath); return this; }
@Override public JsonParser fetch(long amount) { Arguments.require(amount > 0L, "Fetch amount must be > 0L"); demand += amount; if (demand < 0L) { demand = Long.MAX_VALUE; } checkPending(); return this; }
/** * Add a certificate as a buffer * * @param certValue the certificate to add * @return a reference to this, so the API can be used fluently */ @GenIgnore public PemKeyCertOptions addCertValue(Buffer certValue) { Arguments.require(certValue != null, "Null certValue"); certValues.add(certValue); return this; }
@Override public synchronized AsyncFile read(Buffer buffer, int offset, long position, int length, Handler<AsyncResult<Buffer>> handler) { Objects.requireNonNull(buffer, "buffer"); Objects.requireNonNull(handler, "handler"); Arguments.require(offset >= 0, "offset must be >= 0"); Arguments.require(position >= 0, "position must be >= 0"); Arguments.require(length >= 0, "length must be >= 0"); check(); ByteBuffer bb = ByteBuffer.allocate(length); doRead(buffer, offset, bb, position, getReadSize(), handler); return this; }
/** * Add a path to a key file * * @param keyPath the path to the key file * @return a reference to this, so the API can be used fluently */ @GenIgnore public PemKeyCertOptions addKeyPath(String keyPath) { Arguments.require(keyPath != null, "Null keyPath"); keyPaths.add(keyPath); return this; }
@Override public void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler) { Objects.requireNonNull(name, "name"); Objects.requireNonNull(resultHandler, "resultHandler"); Arguments.require(timeout >= 0, "timeout must be >= 0"); if (clusterManager == null) { getLocalLock(name, timeout, resultHandler); } else { clusterManager.getLockWithTimeout(name, timeout, resultHandler); } }