You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/09/20 12:48:23 UTC
[25/33] ignite git commit: IGNITE-6399 .NET: Added
ClientConnectorConfiguration. This closes #2696.
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 <pt...@apache.org>
Authored: Tue Sep 19 16:32:07 2017 +0300
Committer: devozerov <vo...@gridgain.com>
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
}
/// <summary>
+ /// Tests that connector can be disabled.
+ /// </summary>
+ [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<AggregateException>(() => Ignition.StartClient(clientCfg));
+ Assert.AreEqual("Failed to establish Ignite thin client connection, " +
+ "examine inner exceptions for details.", ex.Message);
+ }
+ }
+
+ /// <summary>
/// Starts the client.
/// </summary>
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
</memoryPolicies>
</memoryConfiguration>
<sqlConnectorConfiguration host='bar' port='10' portRange='11' socketSendBufferSize='12' socketReceiveBufferSize='13' tcpNoDelay='true' maxOpenCursorsPerConnection='14' threadPoolSize='15' />
+ <clientConnectorConfiguration host='bar' port='10' portRange='11' socketSendBufferSize='12' socketReceiveBufferSize='13' tcpNoDelay='true' maxOpenCursorsPerConnection='14' threadPoolSize='15' />
<persistentStoreConfiguration alwaysWriteFullPages='true' checkpointingFrequency='00:00:1' checkpointingPageBufferSize='2' checkpointingThreads='3' lockWaitTime='00:00:04' persistentStorePath='foo' tlbSize='5' walArchivePath='bar' walFlushFrequency='00:00:06' walFsyncDelayNanos='7' walHistorySize='8' walMode='None' walRecordIteratorBufferSize='9' walSegments='10' walSegmentSize='11' walStorePath='baz' metricsEnabled='true' rateTimeInterval='0:0:6' subIntervals='3' />
</igniteConfig>";
@@ -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.
/// </summary>
// ReSharper disable once UnusedParameter.Local
+ // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
private static void CheckPropertyIsPresentInSchema(Type type, XElement schema)
{
Func<string, string> 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());
}
/// <summary>
@@ -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
}
/// <summary>
+ /// Checks the default properties.
+ /// </summary>
+ /// <param name="cfg">Config.</param>
+ 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);
+ }
+
+ /// <summary>
+ /// Checks the default properties.
+ /// </summary>
+ /// <param name="cfg">Config.</param>
+ 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);
+ }
+
+ /// <summary>
/// Checks the default value attributes.
/// </summary>
/// <param name="obj">The object.</param>
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 @@
<Compile Include="Client\IIgniteClient.cs" />
<Compile Include="Common\ExceptionFactory.cs" />
<Compile Include="Configuration\Package-Info.cs" />
+ <Compile Include="Configuration\ClientConnectorConfiguration.cs" />
<Compile Include="Impl\Binary\BinaryTypeId.cs" />
<Compile Include="Impl\Client\Cache\CacheFlags.cs" />
<Compile Include="Impl\Client\Cache\Query\ClientQueryCursor.cs" />
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.
/// <para />
/// Ignite thin client connects to a specific Ignite node with a socket and does not start JVM in process.
- /// This configuration should correspond to <see cref="IgniteConfiguration.SqlConnectorConfiguration"/>
+ /// This configuration should correspond to <see cref="IgniteConfiguration.ClientConnectorConfiguration"/>
/// on a target node.
/// </summary>
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;
+
+ /// <summary>
+ /// Client connector configuration (ODBC, JDBC, Thin Client).
+ /// </summary>
+ public class ClientConnectorConfiguration
+ {
+ /// <summary>
+ /// Default port.
+ /// </summary>
+ public const int DefaultPort = 10800;
+
+ /// <summary>
+ /// Default port range.
+ /// </summary>
+ public const int DefaultPortRange = 100;
+
+ /// <summary>
+ /// Default socket buffer size.
+ /// </summary>
+ public const int DefaultSocketBufferSize = 0;
+
+ /// <summary>
+ /// Default value of <see cref="TcpNoDelay" /> property.
+ /// </summary>
+ public const bool DefaultTcpNoDelay = true;
+
+ /// <summary>
+ /// Default maximum number of open cursors per connection.
+ /// </summary>
+ public const int DefaultMaxOpenCursorsPerConnection = 128;
+
+ /// <summary>
+ /// Default SQL connector thread pool size.
+ /// </summary>
+ public static readonly int DefaultThreadPoolSize = IgniteConfiguration.DefaultThreadPoolSize;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ClientConnectorConfiguration"/> class.
+ /// </summary>
+ public ClientConnectorConfiguration()
+ {
+ Port = DefaultPort;
+ PortRange = DefaultPortRange;
+ SocketSendBufferSize = DefaultSocketBufferSize;
+ SocketReceiveBufferSize = DefaultSocketBufferSize;
+ TcpNoDelay = DefaultTcpNoDelay;
+ MaxOpenCursorsPerConnection = DefaultMaxOpenCursorsPerConnection;
+ ThreadPoolSize = DefaultThreadPoolSize;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ClientConnectorConfiguration"/> class.
+ /// </summary>
+ 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();
+ }
+
+ /// <summary>
+ /// Writes to the specified writer.
+ /// </summary>
+ 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);
+ }
+
+ /// <summary>
+ /// Gets or sets the host.
+ /// </summary>
+ public string Host { get; set; }
+
+ /// <summary>
+ /// Gets or sets the port.
+ /// </summary>
+ [DefaultValue(DefaultPort)]
+ public int Port { get; set; }
+
+ /// <summary>
+ /// Gets or sets the port range.
+ /// </summary>
+ [DefaultValue(DefaultPortRange)]
+ public int PortRange { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the socket send buffer. When set to 0, operating system default is used.
+ /// </summary>
+ [DefaultValue(DefaultSocketBufferSize)]
+ public int SocketSendBufferSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the socket receive buffer. When set to 0, operating system default is used.
+ /// </summary>
+ [DefaultValue(DefaultSocketBufferSize)]
+ public int SocketReceiveBufferSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the value for <c>TCP_NODELAY</c> socket option. Each
+ /// socket will be opened using provided value.
+ /// <para />
+ /// Setting this option to <c>true</c> disables Nagle's algorithm
+ /// for socket decreasing latency and delivery time for small messages.
+ /// <para />
+ /// For systems that work under heavy network load it is advisable to set this value to <c>false</c>.
+ /// </summary>
+ [DefaultValue(DefaultTcpNoDelay)]
+ public bool TcpNoDelay { get; set; }
+
+ /// <summary>
+ /// Gets or sets the maximum open cursors per connection.
+ /// </summary>
+ [DefaultValue(DefaultMaxOpenCursorsPerConnection)]
+ public int MaxOpenCursorsPerConnection { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the thread pool.
+ /// </summary>
+ 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
/// <summary>
/// SQL connector configuration (for ODBC and JDBC).
/// </summary>
+ [Obsolete("Use ClientConnectorConfiguration instead.")]
public class SqlConnectorConfiguration
{
/// <summary>
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
/// </summary>
public static readonly TimeSpan DefaultLongQueryWarningTimeout = TimeSpan.FromMilliseconds(3000);
+ /// <summary>
+ /// Default value for <see cref="ClientConnectorConfigurationEnabled"/>.
+ /// </summary>
+ public const bool DefaultClientConnectorConfigurationEnabled = true;
+
/** */
private TimeSpan? _metricsExpireTime;
@@ -209,6 +214,7 @@ namespace Apache.Ignite.Core
{
JvmInitialMemoryMb = DefaultJvmInitMem;
JvmMaxMemoryMb = DefaultJvmMaxMem;
+ ClientConnectorConfigurationEnabled = DefaultClientConnectorConfigurationEnabled;
}
/// <summary>
@@ -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
/// <summary>
/// Gets or sets the SQL connector configuration (for JDBC and ODBC).
/// </summary>
+ [Obsolete("Use ClientConnectorConfiguration instead.")]
public SqlConnectorConfiguration SqlConnectorConfiguration { get; set; }
/// <summary>
+ /// Gets or sets the client connector configuration (for JDBC, ODBC, and thin clients).
+ /// </summary>
+ public ClientConnectorConfiguration ClientConnectorConfiguration { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether client connector is enabled:
+ /// allow thin clients, ODBC and JDBC drivers to work with Ignite
+ /// (see <see cref="ClientConnectorConfiguration"/>).
+ /// Default is <see cref="DefaultClientConnectorConfigurationEnabled"/>.
+ /// </summary>
+ [DefaultValue(DefaultClientConnectorConfigurationEnabled)]
+ public bool ClientConnectorConfigurationEnabled { get; set; }
+
+ /// <summary>
/// Gets or sets the timeout after which long query warning will be printed.
/// </summary>
[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 @@
</xs:attribute>
</xs:complexType>
</xs:element>
+ <xs:element name="clientConnectorConfiguration" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Client connector configuration (JDBC, ODBC, thin clients).</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="port" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Connector port.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="host" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Connector host.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="portRange" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Connector port range.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="socketSendBufferSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the socket send buffer.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="socketReceiveBufferSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the socket receive buffer.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="tcpNoDelay" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>TCP_NODELAY socket option.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxOpenCursorsPerConnection" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Maximum open cursors per connection.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="threadPoolSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>SQL connector thread pool size.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
<xs:element name="persistentStoreConfiguration" minOccurs="0">
<xs:annotation>
<xs:documentation>Persistent store configuration.</xs:documentation>
@@ -1653,6 +1700,11 @@
<xs:documentation>Whether grid should be active on start.</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="clientConnectorConfigurationEnabled" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>Whether client connector should be enabled (allow thin clients, ODBC and JDBC drivers to work with Ignite).</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>