You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/06/09 13:45:55 UTC
[10/40] ignite git commit: IGNITE-5400 .NET:
IgniteConfiguration.SqlConnectorConfiguration
IGNITE-5400 .NET: IgniteConfiguration.SqlConnectorConfiguration
This closes #2085
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/86d0049b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/86d0049b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/86d0049b
Branch: refs/heads/ignite-5267
Commit: 86d0049b7a248cf6f9fe2532b63d0e22baaa659e
Parents: 56768a2
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Jun 7 12:08:34 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Jun 7 12:08:34 2017 +0300
----------------------------------------------------------------------
.../utils/PlatformConfigurationUtils.java | 86 ++++++++++
.../IgniteConfigurationSerializerTest.cs | 26 ++-
.../IgniteConfigurationTest.cs | 56 +++++++
.../Apache.Ignite.Core.csproj | 2 +
.../Configuration/Package-Info.cs | 26 +++
.../Configuration/SqlConnectorConfiguration.cs | 159 ++++++++++++++++++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 164 +++++++++++++++++++
.../IgniteConfigurationSection.xsd | 92 +++++++++++
.../Common/IgniteConfigurationXmlSerializer.cs | 10 ++
9 files changed, 620 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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 7f23b85..40dafbd 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
@@ -58,6 +58,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.configuration.SqlConnectorConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
@@ -562,6 +563,26 @@ public class PlatformConfigurationUtils {
if (in.readBoolean())
cfg.setClientFailureDetectionTimeout(in.readLong());
+ // Thread pools.
+ if (in.readBoolean())
+ cfg.setPublicThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setStripedPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setServiceThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setSystemThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setAsyncCallbackPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setManagementThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setDataStreamerThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setUtilityCachePoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setQueryThreadPoolSize(in.readInt());
+
readCacheConfigurations(in, cfg);
readDiscoveryConfiguration(in, cfg);
@@ -650,6 +671,9 @@ public class PlatformConfigurationUtils {
if (in.readBoolean())
cfg.setMemoryConfiguration(readMemoryConfiguration(in));
+ if (in.readBoolean())
+ cfg.setSqlConnectorConfiguration(readSqlConnectorConfiguration(in));
+
readPluginConfiguration(cfg, in);
}
@@ -978,6 +1002,26 @@ public class PlatformConfigurationUtils {
w.writeBoolean(true);
w.writeLong(cfg.getClientFailureDetectionTimeout());
+ // Thread pools.
+ w.writeBoolean(true);
+ w.writeInt(cfg.getPublicThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getStripedPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getServiceThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getSystemThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getAsyncCallbackPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getManagementThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getDataStreamerThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getUtilityCacheThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getQueryThreadPoolSize());
+
CacheConfiguration[] cacheCfg = cfg.getCacheConfiguration();
if (cacheCfg != null) {
@@ -1084,6 +1128,8 @@ public class PlatformConfigurationUtils {
writeMemoryConfiguration(w, cfg.getMemoryConfiguration());
+ writeSqlConnectorConfiguration(w, cfg.getSqlConnectorConfiguration());
+
w.writeString(cfg.getIgniteHome());
w.writeLong(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit());
@@ -1371,7 +1417,47 @@ public class PlatformConfigurationUtils {
}
}
+ /**
+ * Reads the SQL connector configuration.
+ *
+ * @param in Reader.
+ * @return Config.
+ */
+ private static SqlConnectorConfiguration readSqlConnectorConfiguration(BinaryRawReader in) {
+ return new SqlConnectorConfiguration()
+ .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 SQL connector configuration.
+ *
+ * @param w Writer.
+ */
+ private static void writeSqlConnectorConfiguration(BinaryRawWriter w, SqlConnectorConfiguration 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);
+ }
+ }
/**
* Private constructor.
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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 c726f85..7ba4ed2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -40,6 +40,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Cache.Store;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Communication.Tcp;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.DataStructures.Configuration;
using Apache.Ignite.Core.Deployment;
using Apache.Ignite.Core.Discovery.Tcp;
@@ -140,6 +141,7 @@ namespace Apache.Ignite.Core.Tests
<memoryPolicyConfiguration emptyPagesPoolSize='1' evictionThreshold='0.2' name='dfPlc' pageEvictionMode='RandomLru' initialSize='89' maxSize='98' swapFilePath='abc' metricsEnabled='true' rateTimeInterval='0:1:2' subIntervals='9' />
</memoryPolicies>
</memoryConfiguration>
+ <sqlConnectorConfiguration host='bar' port='10' portRange='11' socketSendBufferSize='12' socketReceiveBufferSize='13' tcpNoDelay='true' maxOpenCursorsPerConnection='14' threadPoolSize='15' />
</igniteConfig>";
var cfg = IgniteConfiguration.FromXml(xml);
@@ -278,6 +280,17 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(TimeSpan.FromSeconds(62), memPlc.RateTimeInterval);
Assert.AreEqual(PeerAssemblyLoadingMode.CurrentAppDomain, cfg.PeerAssemblyLoadingMode);
+
+ var sql = cfg.SqlConnectorConfiguration;
+ Assert.IsNotNull(sql);
+ Assert.AreEqual("bar", sql.Host);
+ Assert.AreEqual(10, sql.Port);
+ Assert.AreEqual(11, sql.PortRange);
+ Assert.AreEqual(12, sql.SocketSendBufferSize);
+ Assert.AreEqual(13, sql.SocketReceiveBufferSize);
+ Assert.IsTrue(sql.TcpNoDelay);
+ Assert.AreEqual(14, sql.MaxOpenCursorsPerConnection);
+ Assert.AreEqual(15, sql.ThreadPoolSize);
}
/// <summary>
@@ -839,7 +852,18 @@ namespace Apache.Ignite.Core.Tests
}
}
},
- PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain
+ PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain,
+ SqlConnectorConfiguration = new SqlConnectorConfiguration
+ {
+ Host = "foo",
+ Port = 2,
+ PortRange = 3,
+ MaxOpenCursorsPerConnection = 4,
+ SocketReceiveBufferSize = 5,
+ SocketSendBufferSize = 6,
+ TcpNoDelay = false,
+ ThreadPoolSize = 7
+ }
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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 80b271d..9d19a23 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Cache.Eviction;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Communication.Tcp;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.DataStructures.Configuration;
using Apache.Ignite.Core.Discovery.Tcp;
using Apache.Ignite.Core.Discovery.Tcp.Multicast;
@@ -81,6 +82,7 @@ namespace Apache.Ignite.Core.Tests
CheckDefaultValueAttributes(new MemoryEventStorageSpi());
CheckDefaultValueAttributes(new MemoryConfiguration());
CheckDefaultValueAttributes(new MemoryPolicyConfiguration());
+ CheckDefaultValueAttributes(new SqlConnectorConfiguration());
}
/// <summary>
@@ -173,6 +175,16 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(cfg.FailureDetectionTimeout, resCfg.FailureDetectionTimeout);
Assert.AreEqual(cfg.ClientFailureDetectionTimeout, resCfg.ClientFailureDetectionTimeout);
+ Assert.AreEqual(cfg.PublicThreadPoolSize, resCfg.PublicThreadPoolSize);
+ Assert.AreEqual(cfg.StripedThreadPoolSize, resCfg.StripedThreadPoolSize);
+ Assert.AreEqual(cfg.ServiceThreadPoolSize, resCfg.ServiceThreadPoolSize);
+ Assert.AreEqual(cfg.SystemThreadPoolSize, resCfg.SystemThreadPoolSize);
+ Assert.AreEqual(cfg.AsyncCallbackThreadPoolSize, resCfg.AsyncCallbackThreadPoolSize);
+ Assert.AreEqual(cfg.ManagementThreadPoolSize, resCfg.ManagementThreadPoolSize);
+ Assert.AreEqual(cfg.DataStreamerThreadPoolSize, resCfg.DataStreamerThreadPoolSize);
+ Assert.AreEqual(cfg.UtilityCacheThreadPoolSize, resCfg.UtilityCacheThreadPoolSize);
+ Assert.AreEqual(cfg.QueryThreadPoolSize, resCfg.QueryThreadPoolSize);
+
var binCfg = cfg.BinaryConfiguration;
Assert.IsFalse(binCfg.CompactFooter);
@@ -218,6 +230,18 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(plc.Name, resPlc.Name);
Assert.AreEqual(plc.SwapFilePath, resPlc.SwapFilePath);
}
+
+ var sql = cfg.SqlConnectorConfiguration;
+ var resSql = resCfg.SqlConnectorConfiguration;
+
+ Assert.AreEqual(sql.Host, resSql.Host);
+ Assert.AreEqual(sql.Port, resSql.Port);
+ Assert.AreEqual(sql.PortRange, resSql.PortRange);
+ Assert.AreEqual(sql.MaxOpenCursorsPerConnection, resSql.MaxOpenCursorsPerConnection);
+ Assert.AreEqual(sql.SocketReceiveBufferSize, resSql.SocketReceiveBufferSize);
+ Assert.AreEqual(sql.SocketSendBufferSize, resSql.SocketSendBufferSize);
+ Assert.AreEqual(sql.TcpNoDelay, resSql.TcpNoDelay);
+ Assert.AreEqual(sql.ThreadPoolSize, resSql.ThreadPoolSize);
}
}
@@ -455,6 +479,17 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(IgniteConfiguration.DefaultFailureDetectionTimeout, cfg.FailureDetectionTimeout);
Assert.AreEqual(IgniteConfiguration.DefaultClientFailureDetectionTimeout,
cfg.ClientFailureDetectionTimeout);
+
+ // Thread pools.
+ Assert.AreEqual(IgniteConfiguration.DefaultManagementThreadPoolSize, cfg.ManagementThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.PublicThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.StripedThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.ServiceThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.SystemThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.AsyncCallbackThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.DataStreamerThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.UtilityCacheThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.QueryThreadPoolSize);
}
/// <summary>
@@ -466,6 +501,7 @@ namespace Apache.Ignite.Core.Tests
var props = obj.GetType().GetProperties();
foreach (var prop in props.Where(p => p.Name != "SelectorsCount" && p.Name != "ReadStripesNumber" &&
+ !p.Name.Contains("ThreadPoolSize") &&
!(p.Name == "MaxSize" &&
p.DeclaringType == typeof(MemoryPolicyConfiguration))))
{
@@ -615,6 +651,26 @@ namespace Apache.Ignite.Core.Tests
MetricsEnabled = true
}
}
+ },
+ PublicThreadPoolSize = 3,
+ StripedThreadPoolSize = 5,
+ ServiceThreadPoolSize = 6,
+ SystemThreadPoolSize = 7,
+ AsyncCallbackThreadPoolSize = 8,
+ ManagementThreadPoolSize = 9,
+ DataStreamerThreadPoolSize = 10,
+ UtilityCacheThreadPoolSize = 11,
+ QueryThreadPoolSize = 12,
+ SqlConnectorConfiguration = new SqlConnectorConfiguration
+ {
+ Host = "127.0.0.2",
+ Port = 1081,
+ PortRange = 3,
+ SocketReceiveBufferSize = 2048,
+ MaxOpenCursorsPerConnection = 5,
+ ThreadPoolSize = 4,
+ TcpNoDelay = false,
+ SocketSendBufferSize = 4096
}
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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 b37b685..82bb5ca 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -98,6 +98,8 @@
<Compile Include="Cache\Configuration\PartitionLossPolicy.cs" />
<Compile Include="Cache\IMemoryMetrics.cs" />
<Compile Include="Common\ExceptionFactory.cs" />
+ <Compile Include="Configuration\Package-Info.cs" />
+ <Compile Include="Configuration\SqlConnectorConfiguration.cs" />
<Compile Include="Deployment\PeerAssemblyLoadingMode.cs" />
<Compile Include="Events\IEventStorageSpi.cs" />
<Compile Include="Events\MemoryEventStorageSpi.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs
new file mode 100644
index 0000000..f2dfb53
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs
@@ -0,0 +1,26 @@
+/*
+* 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.
+*/
+
+#pragma warning disable 1587 // invalid XML comment
+
+/// <summary>
+/// General configuration APIs.
+/// </summary>
+namespace Apache.Ignite.Core.Configuration
+{
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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
new file mode 100644
index 0000000..0a9b7e5
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.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>
+ /// SQL connector configuration (for ODBC and JDBC).
+ /// </summary>
+ public class SqlConnectorConfiguration
+ {
+ /// <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="SqlConnectorConfiguration"/> class.
+ /// </summary>
+ public SqlConnectorConfiguration()
+ {
+ Port = DefaultPort;
+ PortRange = DefaultPortRange;
+ SocketSendBufferSize = DefaultSocketBufferSize;
+ SocketReceiveBufferSize = DefaultSocketBufferSize;
+ TcpNoDelay = DefaultTcpNoDelay;
+ MaxOpenCursorsPerConnection = DefaultMaxOpenCursorsPerConnection;
+ ThreadPoolSize = DefaultThreadPoolSize;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SqlConnectorConfiguration"/> class.
+ /// </summary>
+ internal SqlConnectorConfiguration(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/86d0049b/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 8fab8a4..40bab15 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -34,6 +34,7 @@ namespace Apache.Ignite.Core
using Apache.Ignite.Core.Communication;
using Apache.Ignite.Core.Communication.Tcp;
using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.DataStructures.Configuration;
using Apache.Ignite.Core.Deployment;
using Apache.Ignite.Core.Discovery;
@@ -103,6 +104,16 @@ namespace Apache.Ignite.Core
/// </summary>
public static readonly TimeSpan DefaultClientFailureDetectionTimeout = TimeSpan.FromSeconds(30);
+ /// <summary>
+ /// Default thread pool size.
+ /// </summary>
+ public static readonly int DefaultThreadPoolSize = Math.Max(8, Environment.ProcessorCount);
+
+ /// <summary>
+ /// Default management thread pool size.
+ /// </summary>
+ public const int DefaultManagementThreadPoolSize = 4;
+
/** */
private TimeSpan? _metricsExpireTime;
@@ -139,6 +150,33 @@ namespace Apache.Ignite.Core
/** */
private TimeSpan? _clientFailureDetectionTimeout;
+ /** */
+ private int? _publicThreadPoolSize;
+
+ /** */
+ private int? _stripedThreadPoolSize;
+
+ /** */
+ private int? _serviceThreadPoolSize;
+
+ /** */
+ private int? _systemThreadPoolSize;
+
+ /** */
+ private int? _asyncCallbackThreadPoolSize;
+
+ /** */
+ private int? _managementThreadPoolSize;
+
+ /** */
+ private int? _dataStreamerThreadPoolSize;
+
+ /** */
+ private int? _utilityCacheThreadPoolSize;
+
+ /** */
+ private int? _queryThreadPoolSize;
+
/// <summary>
/// Default network retry count.
/// </summary>
@@ -222,6 +260,17 @@ namespace Apache.Ignite.Core
writer.WriteTimeSpanAsLongNullable(_failureDetectionTimeout);
writer.WriteTimeSpanAsLongNullable(_clientFailureDetectionTimeout);
+ // Thread pools
+ writer.WriteIntNullable(_publicThreadPoolSize);
+ writer.WriteIntNullable(_stripedThreadPoolSize);
+ writer.WriteIntNullable(_serviceThreadPoolSize);
+ writer.WriteIntNullable(_systemThreadPoolSize);
+ writer.WriteIntNullable(_asyncCallbackThreadPoolSize);
+ writer.WriteIntNullable(_managementThreadPoolSize);
+ writer.WriteIntNullable(_dataStreamerThreadPoolSize);
+ writer.WriteIntNullable(_utilityCacheThreadPoolSize);
+ writer.WriteIntNullable(_queryThreadPoolSize);
+
// Cache config
var caches = CacheConfiguration;
@@ -371,6 +420,17 @@ namespace Apache.Ignite.Core
writer.WriteBoolean(false);
}
+ // SQL
+ if (SqlConnectorConfiguration != null)
+ {
+ writer.WriteBoolean(true);
+ SqlConnectorConfiguration.Write(writer);
+ }
+ else
+ {
+ writer.WriteBoolean(false);
+ }
+
// Plugins (should be last)
if (PluginConfigurations != null)
{
@@ -438,6 +498,17 @@ namespace Apache.Ignite.Core
_failureDetectionTimeout = r.ReadTimeSpanNullable();
_clientFailureDetectionTimeout = r.ReadTimeSpanNullable();
+ // Thread pools
+ _publicThreadPoolSize = r.ReadIntNullable();
+ _stripedThreadPoolSize = r.ReadIntNullable();
+ _serviceThreadPoolSize = r.ReadIntNullable();
+ _systemThreadPoolSize = r.ReadIntNullable();
+ _asyncCallbackThreadPoolSize = r.ReadIntNullable();
+ _managementThreadPoolSize = r.ReadIntNullable();
+ _dataStreamerThreadPoolSize = r.ReadIntNullable();
+ _utilityCacheThreadPoolSize = r.ReadIntNullable();
+ _queryThreadPoolSize = r.ReadIntNullable();
+
// Cache config
var cacheCfgCount = r.ReadInt();
CacheConfiguration = new List<CacheConfiguration>(cacheCfgCount);
@@ -509,6 +580,12 @@ namespace Apache.Ignite.Core
{
MemoryConfiguration = new MemoryConfiguration(r);
}
+
+ // SQL
+ if (r.ReadBoolean())
+ {
+ SqlConnectorConfiguration = new SqlConnectorConfiguration(r);
+ }
}
/// <summary>
@@ -995,5 +1072,92 @@ namespace Apache.Ignite.Core
/// Peer loading is enabled for <see cref="ICompute"/> functionality.
/// </summary>
public PeerAssemblyLoadingMode PeerAssemblyLoadingMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the public thread pool, which processes compute jobs and user messages.
+ /// </summary>
+ public int PublicThreadPoolSize
+ {
+ get { return _publicThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _publicThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the striped thread pool, which processes cache requests.
+ /// </summary>
+ public int StripedThreadPoolSize
+ {
+ get { return _stripedThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _stripedThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the service thread pool, which processes Ignite services.
+ /// </summary>
+ public int ServiceThreadPoolSize
+ {
+ get { return _serviceThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _serviceThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the system thread pool, which processes internal system messages.
+ /// </summary>
+ public int SystemThreadPoolSize
+ {
+ get { return _systemThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _systemThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the asynchronous callback thread pool.
+ /// </summary>
+ public int AsyncCallbackThreadPoolSize
+ {
+ get { return _asyncCallbackThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _asyncCallbackThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the management thread pool, which processes internal Ignite jobs.
+ /// </summary>
+ [DefaultValue(DefaultManagementThreadPoolSize)]
+ public int ManagementThreadPoolSize
+ {
+ get { return _managementThreadPoolSize ?? DefaultManagementThreadPoolSize; }
+ set { _managementThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the data streamer thread pool.
+ /// </summary>
+ public int DataStreamerThreadPoolSize
+ {
+ get { return _dataStreamerThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _dataStreamerThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the utility cache thread pool.
+ /// </summary>
+ public int UtilityCacheThreadPoolSize
+ {
+ get { return _utilityCacheThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _utilityCacheThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the query thread pool.
+ /// </summary>
+ public int QueryThreadPoolSize
+ {
+ get { return _queryThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _queryThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the SQL connector configuration (for JDBC and ODBC).
+ /// </summary>
+ public SqlConnectorConfiguration SqlConnectorConfiguration { get; set; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/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 fae4ebb..0cd58ed 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -1247,6 +1247,53 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>
+ </xs:element>
+ <xs:element name="sqlConnectorConfiguration" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>SQL connector configuration (JDBC and ODBC).</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="pluginConfigurations" minOccurs="0">
<xs:annotation>
@@ -1433,6 +1480,51 @@
<xs:documentation>Indicates whether user assemblies should be loaded on remote nodes automatically.</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="publicThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the public thread pool, which processes compute jobs and user messages.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="stripedThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the striped thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="serviceThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the service thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="systemThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the system thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="asyncCallbackThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the async callback thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="managementThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the management thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="dataStreamerThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the data streamer thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="utilityCacheThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the utility cache thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="queryThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the query thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
index 6c5d620..775add4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
@@ -529,12 +529,22 @@ namespace Apache.Ignite.Core.Impl.Common
var attr = property.GetCustomAttributes(true).OfType<DefaultValueAttribute>().FirstOrDefault();
if (attr != null)
+ {
return attr.Value;
+ }
+
+ var declType = property.DeclaringType;
+ if (declType != null && !declType.IsAbstract && declType.GetConstructor(new Type[0]) != null)
+ {
+ return property.GetValue(Activator.CreateInstance(declType), null);
+ }
var propertyType = property.PropertyType;
if (propertyType.IsValueType)
+ {
return Activator.CreateInstance(propertyType);
+ }
return null;
}