Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CE0B0200D15 for ; Wed, 20 Sep 2017 14:48:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CC7D81609E1; Wed, 20 Sep 2017 12:48:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 42C511609E8 for ; Wed, 20 Sep 2017 14:48:02 +0200 (CEST) Received: (qmail 69868 invoked by uid 500); 20 Sep 2017 12:48:01 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 68947 invoked by uid 99); 20 Sep 2017 12:48:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Sep 2017 12:48:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 69720F5A08; Wed, 20 Sep 2017 12:47:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Wed, 20 Sep 2017 12:48:23 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [25/33] ignite git commit: IGNITE-6399 .NET: Added ClientConnectorConfiguration. This closes #2696. archived-at: Wed, 20 Sep 2017 12:48:04 -0000 IGNITE-6399 .NET: Added ClientConnectorConfiguration. This closes #2696. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/51f1c67b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/51f1c67b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/51f1c67b Branch: refs/heads/ignite-3478 Commit: 51f1c67bbdcdee142964bdb613dc906d960d07ec Parents: 29594db Author: Pavel Tupitsyn Authored: Tue Sep 19 16:32:07 2017 +0300 Committer: devozerov Committed: Tue Sep 19 16:32:07 2017 +0300 ---------------------------------------------------------------------- .../utils/PlatformConfigurationUtils.java | 53 +++++++ .../Client/Cache/ScanQueryTest.cs | 2 +- .../Client/ClientConnectionTest.cs | 26 ++- .../Client/RawSocketTest.cs | 4 +- .../IgniteConfigurationSerializerTest.cs | 17 +- .../IgniteConfigurationTest.cs | 40 +++++ .../Apache.Ignite.Core.csproj | 1 + .../Client/IgniteClientConfiguration.cs | 2 +- .../ClientConnectorConfiguration.cs | 159 +++++++++++++++++++ .../Configuration/SqlConnectorConfiguration.cs | 2 + .../Apache.Ignite.Core/IgniteConfiguration.cs | 50 +++++- .../IgniteConfigurationSection.xsd | 52 ++++++ 12 files changed, 400 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java index d54aac1..7e17bdb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java @@ -53,6 +53,7 @@ import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; import org.apache.ignite.configuration.AtomicConfiguration; import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.ClientConnectorConfiguration; import org.apache.ignite.configuration.DataPageEvictionMode; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.MemoryConfiguration; @@ -682,6 +683,12 @@ public class PlatformConfigurationUtils { cfg.setSqlConnectorConfiguration(readSqlConnectorConfiguration(in)); if (in.readBoolean()) + cfg.setClientConnectorConfiguration(readClientConnectorConfiguration(in)); + + if (!in.readBoolean()) // ClientConnectorConfigurationEnabled override + cfg.setClientConnectorConfiguration(null); + + if (in.readBoolean()) cfg.setPersistentStoreConfiguration(readPersistentStoreConfiguration(in)); readPluginConfiguration(cfg, in); @@ -1147,6 +1154,10 @@ public class PlatformConfigurationUtils { writeSqlConnectorConfiguration(w, cfg.getSqlConnectorConfiguration()); + writeClientConnectorConfiguration(w, cfg.getClientConnectorConfiguration()); + + w.writeBoolean(cfg.getClientConnectorConfiguration() != null); + writePersistentStoreConfiguration(w, cfg.getPersistentStoreConfiguration()); w.writeString(cfg.getIgniteHome()); @@ -1483,6 +1494,48 @@ public class PlatformConfigurationUtils { } /** + * Reads the client connector configuration. + * + * @param in Reader. + * @return Config. + */ + private static ClientConnectorConfiguration readClientConnectorConfiguration(BinaryRawReader in) { + return new ClientConnectorConfiguration() + .setHost(in.readString()) + .setPort(in.readInt()) + .setPortRange(in.readInt()) + .setSocketSendBufferSize(in.readInt()) + .setSocketReceiveBufferSize(in.readInt()) + .setTcpNoDelay(in.readBoolean()) + .setMaxOpenCursorsPerConnection(in.readInt()) + .setThreadPoolSize(in.readInt()); + } + + /** + * Writes the client connector configuration. + * + * @param w Writer. + */ + private static void writeClientConnectorConfiguration(BinaryRawWriter w, ClientConnectorConfiguration cfg) { + assert w != null; + + if (cfg != null) { + w.writeBoolean(true); + + w.writeString(cfg.getHost()); + w.writeInt(cfg.getPort()); + w.writeInt(cfg.getPortRange()); + w.writeInt(cfg.getSocketSendBufferSize()); + w.writeInt(cfg.getSocketReceiveBufferSize()); + w.writeBoolean(cfg.isTcpNoDelay()); + w.writeInt(cfg.getMaxOpenCursorsPerConnection()); + w.writeInt(cfg.getThreadPoolSize()); + } else { + w.writeBoolean(false); + } + } + + /** * Reads the persistence store connector configuration. * * @param in Reader. http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ScanQueryTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ScanQueryTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ScanQueryTest.cs index bc1e8ee..7f8b589 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ScanQueryTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ScanQueryTest.cs @@ -46,7 +46,7 @@ namespace Apache.Ignite.Core.Tests.Client.Cache { var cfg = base.GetIgniteConfiguration(); - cfg.SqlConnectorConfiguration = new SqlConnectorConfiguration + cfg.ClientConnectorConfiguration = new ClientConnectorConfiguration { MaxOpenCursorsPerConnection = 3 }; http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs index 8874bb5..7dcec55 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs @@ -79,7 +79,7 @@ namespace Apache.Ignite.Core.Tests.Client { var servCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - SqlConnectorConfiguration = new SqlConnectorConfiguration + ClientConnectorConfiguration = new ClientConnectorConfiguration { Host = "localhost", Port = 2000, @@ -128,6 +128,30 @@ namespace Apache.Ignite.Core.Tests.Client } /// + /// Tests that connector can be disabled. + /// + [Test] + public void TestDisabledConnector() + { + var servCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) + { + ClientConnectorConfigurationEnabled = false + }; + + var clientCfg = new IgniteClientConfiguration + { + Host = "localhost" + }; + + using (Ignition.Start(servCfg)) + { + var ex = Assert.Throws(() => Ignition.StartClient(clientCfg)); + Assert.AreEqual("Failed to establish Ignite thin client connection, " + + "examine inner exceptions for details.", ex.Message); + } + } + + /// /// Starts the client. /// private static IIgniteClient StartClient() http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/RawSocketTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/RawSocketTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/RawSocketTest.cs index 48bd3dd..b34e037 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/RawSocketTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/RawSocketTest.cs @@ -40,7 +40,7 @@ namespace Apache.Ignite.Core.Tests.Client { var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - SqlConnectorConfiguration = new SqlConnectorConfiguration() + ClientConnectorConfiguration = new ClientConnectorConfiguration() }; using (var ignite = Ignition.Start(cfg)) @@ -53,7 +53,7 @@ namespace Apache.Ignite.Core.Tests.Client cache[1] = "bar"; // Connect socket. - var sock = GetSocket(SqlConnectorConfiguration.DefaultPort); + var sock = GetSocket(ClientConnectorConfiguration.DefaultPort); Assert.IsTrue(sock.Connected); DoHandshake(sock); http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs index 125902f..ac214ce 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs @@ -143,6 +143,7 @@ namespace Apache.Ignite.Core.Tests + "; @@ -285,6 +286,7 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(PeerAssemblyLoadingMode.CurrentAppDomain, cfg.PeerAssemblyLoadingMode); +#pragma warning disable 618 // Obsolete var sql = cfg.SqlConnectorConfiguration; Assert.IsNotNull(sql); Assert.AreEqual("bar", sql.Host); @@ -295,6 +297,18 @@ namespace Apache.Ignite.Core.Tests Assert.IsTrue(sql.TcpNoDelay); Assert.AreEqual(14, sql.MaxOpenCursorsPerConnection); Assert.AreEqual(15, sql.ThreadPoolSize); +#pragma warning restore 618 + + var client = cfg.ClientConnectorConfiguration; + Assert.IsNotNull(client); + Assert.AreEqual("bar", client.Host); + Assert.AreEqual(10, client.Port); + Assert.AreEqual(11, client.PortRange); + Assert.AreEqual(12, client.SocketSendBufferSize); + Assert.AreEqual(13, client.SocketReceiveBufferSize); + Assert.IsTrue(client.TcpNoDelay); + Assert.AreEqual(14, client.MaxOpenCursorsPerConnection); + Assert.AreEqual(15, client.ThreadPoolSize); var pers = cfg.PersistentStoreConfiguration; @@ -355,6 +369,7 @@ namespace Apache.Ignite.Core.Tests /// Checks the property is present in schema. /// // ReSharper disable once UnusedParameter.Local + // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local private static void CheckPropertyIsPresentInSchema(Type type, XElement schema) { Func toLowerCamel = x => char.ToLowerInvariant(x[0]) + x.Substring(1); @@ -879,7 +894,7 @@ namespace Apache.Ignite.Core.Tests } }, PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain, - SqlConnectorConfiguration = new SqlConnectorConfiguration + ClientConnectorConfiguration = new ClientConnectorConfiguration { Host = "foo", Port = 2, http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs index 950f36d..5facb38 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs @@ -63,6 +63,8 @@ namespace Apache.Ignite.Core.Tests { CheckDefaultProperties(new IgniteConfiguration()); CheckDefaultProperties(new PersistentStoreConfiguration()); + CheckDefaultProperties(new ClientConnectorConfiguration()); + CheckDefaultProperties(new SqlConnectorConfiguration()); } /// @@ -87,6 +89,7 @@ namespace Apache.Ignite.Core.Tests CheckDefaultValueAttributes(new MemoryConfiguration()); CheckDefaultValueAttributes(new MemoryPolicyConfiguration()); CheckDefaultValueAttributes(new SqlConnectorConfiguration()); + CheckDefaultValueAttributes(new ClientConnectorConfiguration()); CheckDefaultValueAttributes(new PersistentStoreConfiguration()); CheckDefaultValueAttributes(new IgniteClientConfiguration()); } @@ -321,6 +324,9 @@ namespace Apache.Ignite.Core.Tests // Check PersistentStoreConfiguration defaults. CheckDefaultProperties(resCfg.PersistentStoreConfiguration); + + // Connector defaults. + CheckDefaultProperties(resCfg.ClientConnectorConfiguration); } } @@ -515,6 +521,8 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(IgniteConfiguration.DefaultLongQueryWarningTimeout, cfg.LongQueryWarningTimeout); Assert.AreEqual(IgniteConfiguration.DefaultIsLateAffinityAssignment, cfg.IsLateAffinityAssignment); Assert.AreEqual(IgniteConfiguration.DefaultIsActiveOnStart, cfg.IsActiveOnStart); + Assert.AreEqual(IgniteConfiguration.DefaultClientConnectorConfigurationEnabled, + cfg.ClientConnectorConfigurationEnabled); // Thread pools. Assert.AreEqual(IgniteConfiguration.DefaultManagementThreadPoolSize, cfg.ManagementThreadPoolSize); @@ -555,6 +563,38 @@ namespace Apache.Ignite.Core.Tests } /// + /// Checks the default properties. + /// + /// Config. + private static void CheckDefaultProperties(ClientConnectorConfiguration cfg) + { + Assert.AreEqual(ClientConnectorConfiguration.DefaultPort, cfg.Port); + Assert.AreEqual(ClientConnectorConfiguration.DefaultPortRange, cfg.PortRange); + Assert.AreEqual(ClientConnectorConfiguration.DefaultMaxOpenCursorsPerConnection, + cfg.MaxOpenCursorsPerConnection); + Assert.AreEqual(ClientConnectorConfiguration.DefaultSocketBufferSize, cfg.SocketReceiveBufferSize); + Assert.AreEqual(ClientConnectorConfiguration.DefaultSocketBufferSize, cfg.SocketSendBufferSize); + Assert.AreEqual(ClientConnectorConfiguration.DefaultTcpNoDelay, cfg.TcpNoDelay); + Assert.AreEqual(ClientConnectorConfiguration.DefaultThreadPoolSize, cfg.ThreadPoolSize); + } + + /// + /// Checks the default properties. + /// + /// Config. + private static void CheckDefaultProperties(SqlConnectorConfiguration cfg) + { + Assert.AreEqual(ClientConnectorConfiguration.DefaultPort, cfg.Port); + Assert.AreEqual(ClientConnectorConfiguration.DefaultPortRange, cfg.PortRange); + Assert.AreEqual(ClientConnectorConfiguration.DefaultMaxOpenCursorsPerConnection, + cfg.MaxOpenCursorsPerConnection); + Assert.AreEqual(ClientConnectorConfiguration.DefaultSocketBufferSize, cfg.SocketReceiveBufferSize); + Assert.AreEqual(ClientConnectorConfiguration.DefaultSocketBufferSize, cfg.SocketSendBufferSize); + Assert.AreEqual(ClientConnectorConfiguration.DefaultTcpNoDelay, cfg.TcpNoDelay); + Assert.AreEqual(ClientConnectorConfiguration.DefaultThreadPoolSize, cfg.ThreadPoolSize); + } + + /// /// Checks the default value attributes. /// /// The object. http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj index ed34675..4d0ea56 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj @@ -102,6 +102,7 @@ + http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs index 3339c65..8c9b6a1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs @@ -25,7 +25,7 @@ namespace Apache.Ignite.Core.Client /// Ignite thin client configuration. /// /// Ignite thin client connects to a specific Ignite node with a socket and does not start JVM in process. - /// This configuration should correspond to + /// This configuration should correspond to /// on a target node. /// public class IgniteClientConfiguration http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/ClientConnectorConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/ClientConnectorConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/ClientConnectorConfiguration.cs new file mode 100644 index 0000000..8c23d99 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/ClientConnectorConfiguration.cs @@ -0,0 +1,159 @@ +/* + * 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. + */ + +namespace Apache.Ignite.Core.Configuration +{ + using System.ComponentModel; + using System.Diagnostics; + using Apache.Ignite.Core.Binary; + + /// + /// Client connector configuration (ODBC, JDBC, Thin Client). + /// + public class ClientConnectorConfiguration + { + /// + /// Default port. + /// + public const int DefaultPort = 10800; + + /// + /// Default port range. + /// + public const int DefaultPortRange = 100; + + /// + /// Default socket buffer size. + /// + public const int DefaultSocketBufferSize = 0; + + /// + /// Default value of property. + /// + public const bool DefaultTcpNoDelay = true; + + /// + /// Default maximum number of open cursors per connection. + /// + public const int DefaultMaxOpenCursorsPerConnection = 128; + + /// + /// Default SQL connector thread pool size. + /// + public static readonly int DefaultThreadPoolSize = IgniteConfiguration.DefaultThreadPoolSize; + + /// + /// Initializes a new instance of the class. + /// + public ClientConnectorConfiguration() + { + Port = DefaultPort; + PortRange = DefaultPortRange; + SocketSendBufferSize = DefaultSocketBufferSize; + SocketReceiveBufferSize = DefaultSocketBufferSize; + TcpNoDelay = DefaultTcpNoDelay; + MaxOpenCursorsPerConnection = DefaultMaxOpenCursorsPerConnection; + ThreadPoolSize = DefaultThreadPoolSize; + } + + /// + /// Initializes a new instance of the class. + /// + internal ClientConnectorConfiguration(IBinaryRawReader reader) + { + Debug.Assert(reader != null); + + Host = reader.ReadString(); + Port = reader.ReadInt(); + PortRange = reader.ReadInt(); + SocketSendBufferSize = reader.ReadInt(); + SocketReceiveBufferSize = reader.ReadInt(); + TcpNoDelay = reader.ReadBoolean(); + MaxOpenCursorsPerConnection = reader.ReadInt(); + ThreadPoolSize = reader.ReadInt(); + } + + /// + /// Writes to the specified writer. + /// + internal void Write(IBinaryRawWriter writer) + { + Debug.Assert(writer != null); + + writer.WriteString(Host); + writer.WriteInt(Port); + writer.WriteInt(PortRange); + writer.WriteInt(SocketSendBufferSize); + writer.WriteInt(SocketReceiveBufferSize); + writer.WriteBoolean(TcpNoDelay); + writer.WriteInt(MaxOpenCursorsPerConnection); + writer.WriteInt(ThreadPoolSize); + } + + /// + /// Gets or sets the host. + /// + public string Host { get; set; } + + /// + /// Gets or sets the port. + /// + [DefaultValue(DefaultPort)] + public int Port { get; set; } + + /// + /// Gets or sets the port range. + /// + [DefaultValue(DefaultPortRange)] + public int PortRange { get; set; } + + /// + /// Gets or sets the size of the socket send buffer. When set to 0, operating system default is used. + /// + [DefaultValue(DefaultSocketBufferSize)] + public int SocketSendBufferSize { get; set; } + + /// + /// Gets or sets the size of the socket receive buffer. When set to 0, operating system default is used. + /// + [DefaultValue(DefaultSocketBufferSize)] + public int SocketReceiveBufferSize { get; set; } + + /// + /// Gets or sets the value for TCP_NODELAY socket option. Each + /// socket will be opened using provided value. + /// + /// Setting this option to true disables Nagle's algorithm + /// for socket decreasing latency and delivery time for small messages. + /// + /// For systems that work under heavy network load it is advisable to set this value to false. + /// + [DefaultValue(DefaultTcpNoDelay)] + public bool TcpNoDelay { get; set; } + + /// + /// Gets or sets the maximum open cursors per connection. + /// + [DefaultValue(DefaultMaxOpenCursorsPerConnection)] + public int MaxOpenCursorsPerConnection { get; set; } + + /// + /// Gets or sets the size of the thread pool. + /// + public int ThreadPoolSize { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs index 0a9b7e5..dd262ec 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs @@ -17,6 +17,7 @@ namespace Apache.Ignite.Core.Configuration { + using System; using System.ComponentModel; using System.Diagnostics; using Apache.Ignite.Core.Binary; @@ -24,6 +25,7 @@ namespace Apache.Ignite.Core.Configuration /// /// SQL connector configuration (for ODBC and JDBC). /// + [Obsolete("Use ClientConnectorConfiguration instead.")] public class SqlConnectorConfiguration { /// http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs index 4d04348..5ac2258 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs @@ -121,6 +121,11 @@ namespace Apache.Ignite.Core /// public static readonly TimeSpan DefaultLongQueryWarningTimeout = TimeSpan.FromMilliseconds(3000); + /// + /// Default value for . + /// + public const bool DefaultClientConnectorConfigurationEnabled = true; + /** */ private TimeSpan? _metricsExpireTime; @@ -209,6 +214,7 @@ namespace Apache.Ignite.Core { JvmInitialMemoryMb = DefaultJvmInitMem; JvmMaxMemoryMb = DefaultJvmMaxMem; + ClientConnectorConfigurationEnabled = DefaultClientConnectorConfigurationEnabled; } /// @@ -436,17 +442,32 @@ namespace Apache.Ignite.Core writer.WriteBoolean(false); } - // SQL + // SQL connector. +#pragma warning disable 618 // Obsolete if (SqlConnectorConfiguration != null) { writer.WriteBoolean(true); SqlConnectorConfiguration.Write(writer); } +#pragma warning restore 618 + else + { + writer.WriteBoolean(false); + } + + // Client connector. + if (ClientConnectorConfiguration != null) + { + writer.WriteBoolean(true); + ClientConnectorConfiguration.Write(writer); + } else { writer.WriteBoolean(false); } + writer.WriteBoolean(ClientConnectorConfigurationEnabled); + // Persistence. if (PersistentStoreConfiguration != null) { @@ -609,12 +630,22 @@ namespace Apache.Ignite.Core MemoryConfiguration = new MemoryConfiguration(r); } - // SQL + // SQL. if (r.ReadBoolean()) { +#pragma warning disable 618 // Obsolete SqlConnectorConfiguration = new SqlConnectorConfiguration(r); +#pragma warning restore 618 } + // Client. + if (r.ReadBoolean()) + { + ClientConnectorConfiguration = new ClientConnectorConfiguration(r); + } + + ClientConnectorConfigurationEnabled = r.ReadBoolean(); + // Persistence. if (r.ReadBoolean()) { @@ -1196,9 +1227,24 @@ namespace Apache.Ignite.Core /// /// Gets or sets the SQL connector configuration (for JDBC and ODBC). /// + [Obsolete("Use ClientConnectorConfiguration instead.")] public SqlConnectorConfiguration SqlConnectorConfiguration { get; set; } /// + /// Gets or sets the client connector configuration (for JDBC, ODBC, and thin clients). + /// + public ClientConnectorConfiguration ClientConnectorConfiguration { get; set; } + + /// + /// Gets or sets a value indicating whether client connector is enabled: + /// allow thin clients, ODBC and JDBC drivers to work with Ignite + /// (see ). + /// Default is . + /// + [DefaultValue(DefaultClientConnectorConfigurationEnabled)] + public bool ClientConnectorConfigurationEnabled { get; set; } + + /// /// Gets or sets the timeout after which long query warning will be printed. /// [DefaultValue(typeof(TimeSpan), "00:00:03")] http://git-wip-us.apache.org/repos/asf/ignite/blob/51f1c67b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd index d7fd5ac..ac1111b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd @@ -1309,6 +1309,53 @@ + + + Client connector configuration (JDBC, ODBC, thin clients). + + + + + Connector port. + + + + + Connector host. + + + + + Connector port range. + + + + + Size of the socket send buffer. + + + + + Size of the socket receive buffer. + + + + + TCP_NODELAY socket option. + + + + + Maximum open cursors per connection. + + + + + SQL connector thread pool size. + + + + Persistent store configuration. @@ -1653,6 +1700,11 @@ Whether grid should be active on start. + + + Whether client connector should be enabled (allow thin clients, ODBC and JDBC drivers to work with Ignite). + +