Repository: ignite Updated Branches: refs/heads/ignite-1786 ac8137fd2 -> 59c9aa620
IGNITE-2915: ODBC: Removed fine-grained parameters from OdbcConfiguration. This closes #602. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/59c9aa62 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/59c9aa62 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/59c9aa62 Branch: refs/heads/ignite-1786 Commit: 59c9aa62048e265576749af7d5660be6c462b05b Parents: ac8137f Author: isapego <[email protected]> Authored: Mon Apr 11 17:35:46 2016 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Mon Apr 11 17:35:46 2016 +0300 ---------------------------------------------------------------------- .../ignite/configuration/OdbcConfiguration.java | 195 ------------------- .../internal/processors/odbc/OdbcProcessor.java | 28 ++- 2 files changed, 21 insertions(+), 202 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/59c9aa62/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java index 8f0a0fb..65078c4 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java @@ -17,8 +17,6 @@ package org.apache.ignite.configuration; -import java.net.Socket; - /** * ODBC configuration. */ @@ -26,18 +24,6 @@ public class OdbcConfiguration { /** Default TCP server port. */ public static final int DFLT_TCP_PORT = 11443; - /** Default TCP_NODELAY flag. */ - public static final boolean DFLT_TCP_NODELAY = true; - - /** Default TCP direct buffer flag. */ - public static final boolean DFLT_TCP_DIRECT_BUF = false; - - /** Default ODBC idle timeout. */ - public static final int DFLT_IDLE_TIMEOUT = 7000; - - /** Default socket send and receive buffer size. */ - public static final int DFLT_SOCK_BUF_SIZE = 32 * 1024; - /** Default max number of open cursors per connection. */ public static final int DFLT_MAX_OPEN_CURSORS = 128; @@ -47,27 +33,6 @@ public class OdbcConfiguration { /** TCP host. */ private String host; - /** TCP no delay flag. */ - private boolean noDelay = DFLT_TCP_NODELAY; - - /** ODBC TCP direct buffer flag. */ - private boolean directBuf = DFLT_TCP_DIRECT_BUF; - - /** ODBC TCP send buffer size. */ - private int sndBufSize = DFLT_SOCK_BUF_SIZE; - - /** ODBC TCP receive buffer size. */ - private int rcvBufSize = DFLT_SOCK_BUF_SIZE; - - /** ODBC TCP send queue limit. */ - private int sndQueueLimit; - - /** ODBC TCP selector count. */ - private int selectorCnt = Math.min(4, Runtime.getRuntime().availableProcessors()); - - /** Idle timeout. */ - private long idleTimeout = DFLT_IDLE_TIMEOUT; - /** Max number of opened cursors per connection. */ private int maxOpenCursors = DFLT_MAX_OPEN_CURSORS; @@ -87,16 +52,9 @@ public class OdbcConfiguration { public OdbcConfiguration(OdbcConfiguration cfg) { assert cfg != null; - directBuf = cfg.isDirectBuffer(); host = cfg.getHost(); - idleTimeout = cfg.getIdleTimeout(); maxOpenCursors = cfg.getMaxOpenCursors(); - noDelay = cfg.isNoDelay(); port = cfg.getPort(); - rcvBufSize = cfg.getReceiveBufferSize(); - selectorCnt = cfg.getSelectorCount(); - sndBufSize = cfg.getSendBufferSize(); - sndQueueLimit = cfg.getSendQueueLimit(); } /** @@ -145,159 +103,6 @@ public class OdbcConfiguration { } /** - * Gets flag indicating whether {@code TCP_NODELAY} option should be set for accepted client connections. - * Setting this option reduces network latency and should be set to {@code true} in majority of cases. - * For more information, see {@link Socket#setTcpNoDelay(boolean)} - * <p/> - * If not specified, default value is {@link #DFLT_TCP_NODELAY}. - * - * @return Whether {@code TCP_NODELAY} option should be enabled. - */ - public boolean isNoDelay() { - return noDelay; - } - - /** - * Sets whether {@code TCP_NODELAY} option should be set for all accepted ODBC client connections. - * - * @param noDelay {@code True} if option should be enabled. - * @see #isNoDelay() - */ - public void setNoDelay(boolean noDelay) { - this.noDelay = noDelay; - } - - /** - * Gets flag indicating whether ODBC TCP server should use direct buffers. A direct buffer is a buffer - * that is allocated and accessed using native system calls, without using JVM heap. Enabling direct - * buffer <em>may</em> improve performance and avoid memory issues (long GC pauses due to huge buffer - * size). - * <p/> - * If not specified, default value is {@link #DFLT_TCP_DIRECT_BUF}. - * - * @return Whether direct buffer should be used. - */ - public boolean isDirectBuffer() { - return directBuf; - } - - /** - * Sets whether to use direct buffer for ODBC TCP server. - * - * @param directBuf {@code True} if option should be enabled. - * @see #isDirectBuffer() - */ - public void setDirectBuffer(boolean directBuf) { - this.directBuf = directBuf; - } - - /** - * Gets ODBC TCP server send buffer size. - * <p/> - * If not specified, default value is {@link #DFLT_SOCK_BUF_SIZE}. - * - * @return ODBC TCP server send buffer size (0 for default). - */ - public int getSendBufferSize() { - return sndBufSize; - } - - /** - * Sets ODBC TCP server send buffer size. - * - * @param sndBufSize Send buffer size. - * @see #getSendBufferSize() - */ - public void setSendBufferSize(int sndBufSize) { - this.sndBufSize = sndBufSize; - } - - /** - * Gets ODBC TCP server receive buffer size. - * <p/> - * If not specified, default value is {@link #DFLT_SOCK_BUF_SIZE}. - * - * @return ODBC TCP server receive buffer size (0 for default). - */ - public int getReceiveBufferSize() { - return rcvBufSize; - } - - /** - * Sets ODBC TCP server receive buffer size. - * - * @param rcvBufSize Receive buffer size. - * @see #getReceiveBufferSize() - */ - public void setReceiveBufferSize(int rcvBufSize) { - this.rcvBufSize = rcvBufSize; - } - - /** - * Gets ODBC TCP server send queue limit. If the limit exceeds, all successive writes will - * block until the queue has enough capacity. - * - * @return ODBC TCP server send queue limit (0 for unlimited). - */ - public int getSendQueueLimit() { - return sndQueueLimit; - } - - /** - * Sets ODBC TCP server send queue limit. - * - * @param sndQueueLimit ODBC TCP server send queue limit (0 for unlimited). - * @see #getSendQueueLimit() - */ - public void setSendQueueLimit(int sndQueueLimit) { - this.sndQueueLimit = sndQueueLimit; - } - - /** - * Gets number of selector threads in ODBC TCP server. Higher value for this parameter - * may increase throughput, but also increases context switching. - * - * @return Number of selector threads for ODBC TCP server. - */ - public int getSelectorCount() { - return selectorCnt; - } - - /** - * Sets number of selector threads for ODBC TCP server. - * - * @param selectorCnt Number of selector threads for ODBC TCP server. - * @see #getSelectorCount() - */ - public void setSelectorCount(int selectorCnt) { - this.selectorCnt = selectorCnt; - } - - /** - * Gets idle timeout for ODBC TCP server. - * <p> - * This setting is used to reject half-opened sockets. If no packets - * come within idle timeout, the connection is closed. - * <p/> - * If not specified, default value is {@link #DFLT_IDLE_TIMEOUT}. - * - * @return Idle timeout in milliseconds. - */ - public long getIdleTimeout() { - return idleTimeout; - } - - /** - * Sets idle timeout for ODBC TCP server. - * - * @param idleTimeout Idle timeout in milliseconds. - * @see #getIdleTimeout() - */ - public void setIdleTimeout(long idleTimeout) { - this.idleTimeout = idleTimeout; - } - - /** * Gets maximum number of opened cursors per connection. * <p> * Defaults to {@link #DFLT_MAX_OPEN_CURSORS}. http://git-wip-us.apache.org/repos/asf/ignite/blob/59c9aa62/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java index 87be686..cc86237 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java @@ -36,6 +36,21 @@ import java.nio.ByteOrder; * ODBC processor. */ public class OdbcProcessor extends GridProcessorAdapter { + /** Default number of selectors. */ + private static final int DFLT_SELECTOR_CNT = Math.min(4, Runtime.getRuntime().availableProcessors()); + + /** Default TCP_NODELAY flag. */ + private static final boolean DFLT_TCP_NODELAY = true; + + /** Default TCP direct buffer flag. */ + private static final boolean DFLT_TCP_DIRECT_BUF = false; + + /** Default ODBC idle timeout. */ + private static final int DFLT_IDLE_TIMEOUT = 7000; + + /** Default socket send and receive buffer size. */ + private static final int DFLT_SOCK_BUF_SIZE = 32 * 1024; + /** Busy lock. */ private final GridSpinBusyLock busyLock = new GridSpinBusyLock(); @@ -75,17 +90,16 @@ public class OdbcProcessor extends GridProcessorAdapter { .port(port) .listener(new OdbcNioListener(ctx, busyLock)) .logger(log) - .selectorCount(odbcCfg.getSelectorCount()) + .selectorCount(DFLT_SELECTOR_CNT) .gridName(ctx.gridName()) - .tcpNoDelay(odbcCfg.isNoDelay()) - .directBuffer(odbcCfg.isDirectBuffer()) + .tcpNoDelay(DFLT_TCP_NODELAY) + .directBuffer(DFLT_TCP_DIRECT_BUF) .byteOrder(ByteOrder.nativeOrder()) - .socketSendBufferSize(odbcCfg.getSendBufferSize()) - .socketReceiveBufferSize(odbcCfg.getReceiveBufferSize()) - .sendQueueLimit(odbcCfg.getSendQueueLimit()) + .socketSendBufferSize(DFLT_SOCK_BUF_SIZE) + .socketReceiveBufferSize(DFLT_SOCK_BUF_SIZE) .filters(new GridNioCodecFilter(new OdbcBufferedParser(), log, false)) .directMode(false) - .idleTimeout(odbcCfg.getIdleTimeout()) + .idleTimeout(DFLT_IDLE_TIMEOUT) .build(); srv.start();
