All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.imperva.shcf4j.nio.reactor.IOReactorConfig Maven / Gradle / Ivy

Go to download

The Simple HTTP Client Facade for Java (SHCF4J) serves as a simple facade or abstraction for various HTTP client frameworks (e.g. java.net.HttpURLConnection, Apache HttpClient, etc.) allowing the end user to plug in the desired HTTP client framework at deployment time.

The newest version!
package com.imperva.shcf4j.nio.reactor;


import lombok.Builder;
import lombok.Value;

/**
 * IOReactorConfig
 *
 * 

* I/O reactor configuration parameters. *

* * @author maxim.kirilov */ @Builder @Value public class IOReactorConfig { private static final int AVAIL_PROCS = Runtime.getRuntime().availableProcessors(); @Builder.Default private final long selectIntervalMilliseconds = 1000; @Builder.Default private final long shutdownGracePeriod = 500; @Builder.Default private final boolean interestOpQueued = false; @Builder.Default private final int ioThreadCount = AVAIL_PROCS; @Builder.Default private final int soTimeoutMilliseconds = 0; @Builder.Default private final boolean soReuseAddress = false; @Builder.Default private final int soLingerSeconds = -1; @Builder.Default private final boolean soKeepAlive = false; @Builder.Default private final boolean tcpNoDelay = true; @Builder.Default private final int connectTimeoutMilliseconds = 0; @Builder.Default private final int sndBufSize = 0; @Builder.Default private final int rcvBufSize = 0; /** *

* Determines time interval in milliseconds at which the I/O reactor wakes up to check for * timed out sessions and session requests. *

*

* Default: 1000 milliseconds. * * @return the time interval in milliseconds at which the I/O reactor wakes up to check for timed out sessions and session requests */ public long getSelectIntervalMilliseconds() { return this.selectIntervalMilliseconds; } /** *

* Determines grace period in milliseconds the I/O reactors are expected to block waiting * for individual worker threads to terminate cleanly. *

*

* Default: 500 milliseconds. * * @return the grace period in milliseconds the I/O reactors are expected to block waiting for individual worker threads to terminate cleanly. */ public long getShutdownGracePeriod() { return this.shutdownGracePeriod; } /** *

* 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 java.nio.channels.SelectionKey} immediately. *

*

* Default: false * * @return 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 java.nio.channels.SelectionKey} immediately. * @see java.nio.channels.SelectionKey * @see java.nio.channels.SelectionKey#interestOps() * @see java.nio.channels.SelectionKey#interestOps(int) */ public boolean isInterestOpQueued() { return this.interestOpQueued; } /** *

* Determines the number of I/O dispatch threads to be used by the I/O reactor. *

*

* Default: 2 * * @return the number of I/O dispatch threads to be used by the I/O reactor. */ public int getIoThreadCount() { return this.ioThreadCount; } /** *

* Determines the default socket timeout value for non-blocking I/O operations. *

*

* Default: 0 (no timeout) * * @return the default socket timeout value for non-blocking I/O operations. * @see java.net.SocketOptions#SO_TIMEOUT */ public int getSoTimeoutMilliseconds() { return soTimeoutMilliseconds; } /** *

* Determines the default value of the {@link java.net.SocketOptions#SO_REUSEADDR} parameter * for newly created sockets. *

* Default: false * * @return the default value of the {@link java.net.SocketOptions#SO_REUSEADDR} parameter * @see java.net.SocketOptions#SO_REUSEADDR */ public boolean isSoReuseAddress() { return soReuseAddress; } /** *

* Determines the default value of the {@link java.net.SocketOptions#SO_LINGER} parameter * for newly created sockets. *

*

* Default: -1 * * @return the default value of the {@link java.net.SocketOptions#SO_LINGER} parameter for newly created sockets. * @see java.net.SocketOptions#SO_LINGER */ public int getSoLingerSeconds() { return soLingerSeconds; } /** *

* Determines the default value of the {@link java.net.SocketOptions#SO_KEEPALIVE} parameter * for newly created sockets. *

*

* Default: -1 * * @return the default value of the {@link java.net.SocketOptions#SO_KEEPALIVE} parameter for newly created sockets. * @see java.net.SocketOptions#SO_KEEPALIVE */ public boolean isSoKeepalive() { return this.soKeepAlive; } /** *

* Determines the default value of the {@link java.net.SocketOptions#TCP_NODELAY} parameter * for newly created sockets. *

*

* Default: false * * @return the default value of the {@link java.net.SocketOptions#TCP_NODELAY} parameter for newly created sockets. * @see java.net.SocketOptions#TCP_NODELAY */ public boolean isTcpNoDelay() { return tcpNoDelay; } /** *

* Determines the default connect timeout value for non-blocking connection requests. *

*

* Default: 0 (no timeout) * * @return the default connect timeout value for non-blocking connection requests. */ public int getConnectTimeoutMilliseconds() { return connectTimeoutMilliseconds; } /** *

* Determines the default value of the {@link java.net.SocketOptions#SO_SNDBUF} parameter * for newly created sockets. *

*

* Default: 0 (system default) * * @return the default value of the {@link java.net.SocketOptions#SO_SNDBUF} parameter for newly created sockets. * @see java.net.SocketOptions#SO_SNDBUF */ public int getSndBufSize() { return sndBufSize; } /** *

* Determines the default value of the {@link java.net.SocketOptions#SO_RCVBUF} parameter * for newly created sockets. *

*

* Default: 0 (system default) * * @return the default value of the {@link java.net.SocketOptions#SO_RCVBUF} parameter for newly created sockets. * @see java.net.SocketOptions#SO_RCVBUF */ public int getRcvBufSize() { return rcvBufSize; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy