/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
*
1000
milliseconds.
*/
public long getSelectInterval() {
return this.selectInterval;
}
/**
* Defines time interval in milliseconds at which the I/O reactor wakes up to check for
* timed out sessions and session requests. May not be negative or zero.
*/
public void setSelectInterval(long selectInterval) {
if (selectInterval <= 0) {
throw new IllegalArgumentException("Select internal may not be negative or zero");
}
this.selectInterval = selectInterval;
}
/**
* Determines grace period in milliseconds the I/O reactors are expected to block waiting
* for individual worker threads to terminate cleanly.
*
* Default: 500
milliseconds.
*/
public long getShutdownGracePeriod() {
return this.shutdownGracePeriod;
}
/**
* Defines grace period in milliseconds the I/O reactors are expected to block waiting
* for individual worker threads to terminate cleanly. May not be negative or zero.
*/
public void setShutdownGracePeriod(long gracePeriod) {
if (gracePeriod <= 0) {
throw new IllegalArgumentException("Shutdown grace period may not be negative or zero");
}
this.shutdownGracePeriod = gracePeriod;
}
/**
* Determines whether or not I/O interest operations are to be queued and executed
* asynchronously by the I/O reactor thread or to be applied to the underlying
* {@link SelectionKey} immediately.
*
* Default: false
*
* @see SelectionKey
* @see SelectionKey#interestOps()
* @see SelectionKey#interestOps(int)
*/
public boolean isInterestOpQueued() {
return this.interestOpQueued;
}
/**
* Defines whether or not I/O interest operations are to be queued and executed
* asynchronously by the I/O reactor thread or to be applied to the underlying
* {@link SelectionKey} immediately.
*
* @see SelectionKey
* @see SelectionKey#interestOps()
* @see SelectionKey#interestOps(int)
*/
public void setInterestOpQueued(boolean interestOpQueued) {
this.interestOpQueued = interestOpQueued;
}
/**
* Determines the number of I/O dispatch threads to be used by the I/O reactor.
*
* Default: 2
*/
public int getIoThreadCount() {
return this.ioThreadCount;
}
/**
* Defines the number of I/O dispatch threads to be used by the I/O reactor.
* May not be negative or zero.
*/
public void setIoThreadCount(int ioThreadCount) {
if (ioThreadCount <= 0) {
throw new IllegalArgumentException("I/O thread count may not be negative or zero");
}
this.ioThreadCount = ioThreadCount;
}
/**
* Determines the default socket timeout value for non-blocking I/O operations.
*
* Default: 0
(no timeout)
*
* @see SocketOptions#SO_TIMEOUT
*/
public int getSoTimeout() {
return soTimeout;
}
/**
* Defines the default socket timeout value for non-blocking I/O operations.
*
* Default: 0
(no timeout)
*
* @see SocketOptions#SO_TIMEOUT
*/
public void setSoTimeout(int soTimeout) {
this.soTimeout = soTimeout;
}
/**
* Determines the default value of the {@link SocketOptions#SO_REUSEADDR} parameter
* for newly created sockets.
*
* Default: false
*
* @see SocketOptions#SO_REUSEADDR
*/
public boolean isSoReuseAddress() {
return soReuseAddress;
}
/**
* Defines the default value of the {@link SocketOptions#SO_REUSEADDR} parameter
* for newly created sockets.
*
* @see SocketOptions#SO_REUSEADDR
*/
public void setSoReuseAddress(boolean soReuseAddress) {
this.soReuseAddress = soReuseAddress;
}
/**
* Determines the default value of the {@link SocketOptions#SO_LINGER} parameter
* for newly created sockets.
*
* Default: -1
*
* @see SocketOptions#SO_LINGER
*/
public int getSoLinger() {
return soLinger;
}
/**
* Defines the default value of the {@link SocketOptions#SO_LINGER} parameter
* for newly created sockets.
*
* @see SocketOptions#SO_LINGER
*/
public void setSoLinger(int soLinger) {
this.soLinger = soLinger;
}
/**
* Determines the default value of the {@link SocketOptions#SO_KEEPALIVE} parameter
* for newly created sockets.
*
* Default: -1
*
* @see SocketOptions#SO_KEEPALIVE
*/
public boolean isSoKeepalive() {
return this.soKeepAlive;
}
/**
* Defines the default value of the {@link SocketOptions#SO_KEEPALIVE} parameter
* for newly created sockets.
*
* Default: -1
*
* @see SocketOptions#SO_KEEPALIVE
*/
public void setSoKeepalive(boolean soKeepAlive) {
this.soKeepAlive = soKeepAlive;
}
/**
* Determines the default value of the {@link SocketOptions#TCP_NODELAY} parameter
* for newly created sockets.
*
* Default: false
*
* @see SocketOptions#TCP_NODELAY
*/
public boolean isTcpNoDelay() {
return tcpNoDelay;
}
/**
* Defines the default value of the {@link SocketOptions#TCP_NODELAY} parameter
* for newly created sockets.
*
* @see SocketOptions#TCP_NODELAY
*/
public void setTcpNoDelay(boolean tcpNoDelay) {
this.tcpNoDelay = tcpNoDelay;
}
/**
* Determines the default connect timeout value for non-blocking connection requests.
*
* Default: 0
(no timeout)
*/
public int getConnectTimeout() {
return connectTimeout;
}
/**
* Defines the default connect timeout value for non-blocking connection requests.
*/
public void setConnectTimeout(int connectTimeout) {
this.connectTimeout = connectTimeout;
}
@Override
protected IOReactorConfig clone() throws CloneNotSupportedException {
return (IOReactorConfig) super.clone();
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("[selectInterval=").append(this.selectInterval)
.append(", shutdownGracePeriod=").append(this.shutdownGracePeriod)
.append(", interestOpQueued=").append(this.interestOpQueued)
.append(", ioThreadCount=").append(this.ioThreadCount)
.append(", soTimeout=").append(this.soTimeout)
.append(", soReuseAddress=").append(this.soReuseAddress)
.append(", soLinger=").append(this.soLinger)
.append(", soKeepAlive=").append(this.soKeepAlive)
.append(", tcpNoDelay=").append(this.tcpNoDelay)
.append(", connectTimeout=").append(this.connectTimeout).append("]");
return builder.toString();
}
}