Repository: ignite Updated Branches: refs/heads/master 4527fe6de -> 45abb9c70
http://git-wip-us.apache.org/repos/asf/ignite/blob/45abb9c7/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs index 61d0220..c59e9fc 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs @@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Impl.Client using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; + using System.Net; using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Client; using Apache.Ignite.Core.Client.Cache; @@ -39,7 +40,7 @@ namespace Apache.Ignite.Core.Impl.Client internal class IgniteClient : IIgniteInternal, IIgniteClient { /** Socket. */ - private readonly ClientSocket _socket; + private readonly IClientSocket _socket; /** Marshaller. */ private readonly Marshaller _marsh; @@ -63,7 +64,7 @@ namespace Apache.Ignite.Core.Impl.Client _configuration = new IgniteClientConfiguration(clientConfiguration); - _socket = new ClientSocket(_configuration); + _socket = new ClientFailoverSocket(_configuration); _marsh = new Marshaller(_configuration.BinaryConfiguration) { @@ -78,7 +79,7 @@ namespace Apache.Ignite.Core.Impl.Client /// <summary> /// Gets the socket. /// </summary> - public ClientSocket Socket + public IClientSocket Socket { get { return _socket; } } @@ -115,7 +116,7 @@ namespace Apache.Ignite.Core.Impl.Client IgniteArgumentCheck.NotNull(configuration, "configuration"); DoOutOp(ClientOp.CacheGetOrCreateWithConfiguration, - w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration, ServerVersion())); + w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration, ServerVersion)); return GetCache<TK, TV>(configuration.Name); } @@ -136,7 +137,7 @@ namespace Apache.Ignite.Core.Impl.Client IgniteArgumentCheck.NotNull(configuration, "configuration"); DoOutOp(ClientOp.CacheCreateWithConfiguration, - w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration, ServerVersion())); + w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration, ServerVersion)); return GetCache<TK, TV>(configuration.Name); } @@ -175,6 +176,18 @@ namespace Apache.Ignite.Core.Impl.Client } /** <inheritDoc /> */ + public EndPoint RemoteEndPoint + { + get { return _socket.RemoteEndPoint; } + } + + /** <inheritDoc /> */ + public EndPoint LocalEndPoint + { + get { return _socket.LocalEndPoint; } + } + + /** <inheritDoc /> */ public IBinaryProcessor BinaryProcessor { get { return _binProc; } @@ -219,8 +232,9 @@ namespace Apache.Ignite.Core.Impl.Client /// <summary> /// Gets the protocol version supported by server. /// </summary> - public ClientProtocolVersion ServerVersion() { - return _socket.ServerVersion; + public ClientProtocolVersion ServerVersion + { + get { return _socket.ServerVersion; } } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/45abb9c7/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteArgumentCheck.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteArgumentCheck.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteArgumentCheck.cs index 967225b..21c1336 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteArgumentCheck.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteArgumentCheck.cs @@ -43,11 +43,13 @@ namespace Apache.Ignite.Core.Impl.Common /// </summary> /// <param name="arg">The argument.</param> /// <param name="argName">Name of the argument.</param> - public static void NotNullOrEmpty(string arg, string argName) + public static string NotNullOrEmpty(string arg, string argName) { if (string.IsNullOrEmpty(arg)) throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "'{0}' argument should not be null or empty.", argName), argName); + + return arg; } /// <summary> @@ -58,7 +60,7 @@ namespace Apache.Ignite.Core.Impl.Common public static void NotNullOrEmpty<T>(ICollection<T> collection, string argName) { if (collection == null || collection.Count == 0) - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "'{0}' argument should not be null or empty.", argName), argName); } @@ -71,8 +73,8 @@ namespace Apache.Ignite.Core.Impl.Common public static void Ensure(bool condition, string argName, string message) { if (!condition) - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "'{0}' argument is invalid: {1}", argName, message), argName); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/45abb9c7/modules/platforms/dotnet/Apache.Ignite.sln.DotSettings ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.sln.DotSettings b/modules/platforms/dotnet/Apache.Ignite.sln.DotSettings index 5646179..3585f3e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.sln.DotSettings +++ b/modules/platforms/dotnet/Apache.Ignite.sln.DotSettings @@ -9,4 +9,5 @@ <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertClosureToMethodGroup/@EntryIndexedValue">DO_NOT_SHOW</s:String> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EXml_002ECodeStyle_002EFormatSettingsUpgrade_002EXmlMoveToCommonFormatterSettingsUpgrade/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/UnitTesting/ShadowCopy/@EntryValue">False</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=Failover/@EntryIndexedValue">True</s:Boolean> </wpf:ResourceDictionary> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/45abb9c7/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientPutGetExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientPutGetExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientPutGetExample.cs index cc35840..395ac1c 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientPutGetExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientPutGetExample.cs @@ -45,10 +45,7 @@ namespace Apache.Ignite.Examples.ThinClient [STAThread] public static void Main() { - var cfg = new IgniteClientConfiguration - { - Host = "127.0.0.1" - }; + var cfg = new IgniteClientConfiguration("127.0.0.1"); using (IIgniteClient igniteClient = Ignition.StartClient(cfg)) { http://git-wip-us.apache.org/repos/asf/ignite/blob/45abb9c7/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientQueryExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientQueryExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientQueryExample.cs index 61b3a8b..f802087 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientQueryExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientQueryExample.cs @@ -45,10 +45,7 @@ namespace Apache.Ignite.Examples.ThinClient [STAThread] public static void Main() { - var cfg = new IgniteClientConfiguration - { - Host = "127.0.0.1" - }; + var cfg = new IgniteClientConfiguration("127.0.0.1"); using (IIgniteClient igniteClient = Ignition.StartClient(cfg)) { http://git-wip-us.apache.org/repos/asf/ignite/blob/45abb9c7/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientSqlExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientSqlExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientSqlExample.cs index b29ccd0..c46c850 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientSqlExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/ThinClient/ThinClientSqlExample.cs @@ -50,10 +50,7 @@ namespace Apache.Ignite.Examples.ThinClient [STAThread] public static void Main() { - var cfg = new IgniteClientConfiguration - { - Host = "127.0.0.1" - }; + var cfg = new IgniteClientConfiguration("127.0.0.1"); using (IIgniteClient igniteClient = Ignition.StartClient(cfg)) { @@ -66,7 +63,7 @@ namespace Apache.Ignite.Examples.ThinClient Name = CacheName, QueryEntities = new[] { - new QueryEntity(typeof(int), typeof(Employee)), + new QueryEntity(typeof(int), typeof(Employee)), } }; @@ -78,7 +75,7 @@ namespace Apache.Ignite.Examples.ThinClient // Run SQL example. SqlQueryExample(cache); LinqExample(cache); - + // Run SQL fields query example. SqlFieldsQueryExample(cache); LinqFieldsExample(cache); @@ -105,7 +102,7 @@ namespace Apache.Ignite.Examples.ThinClient foreach (var entry in qry) Console.WriteLine(">>> " + entry.Value); } - + /// <summary> /// Queries employees that have provided ZIP code in address. /// </summary> @@ -122,13 +119,13 @@ namespace Apache.Ignite.Examples.ThinClient foreach (ICacheEntry<int, Employee> entry in qry) Console.WriteLine(">>> " + entry.Value); - + Console.WriteLine(); Console.WriteLine(">>> Generated SQL:"); Console.WriteLine(">>> " + qry.ToCacheQueryable().GetFieldsQuery().Sql); } - + /// <summary> /// Queries names and salaries for all employees. /// </summary> @@ -143,7 +140,7 @@ namespace Apache.Ignite.Examples.ThinClient foreach (var row in qry) Console.WriteLine(">>> [Name=" + row[0] + ", salary=" + row[1] + ']'); } - + /// <summary> /// Queries names and salaries for all employees. /// </summary> @@ -157,7 +154,7 @@ namespace Apache.Ignite.Examples.ThinClient foreach (var row in qry) Console.WriteLine(">>> [Name=" + row.Name + ", salary=" + row.Salary + ']'); - + Console.WriteLine(); Console.WriteLine(">>> Generated SQL:"); Console.WriteLine(">>> " + qry.ToCacheQueryable().GetFieldsQuery().Sql); @@ -219,4 +216,4 @@ namespace Apache.Ignite.Examples.ThinClient 2)); } } -} \ No newline at end of file +}