You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by nt...@apache.org on 2016/02/01 15:27:08 UTC
[13/48] ignite git commit: IGNITE-2324: .NET: Added static code
analysis rules and suppressed warnings accordingly.
IGNITE-2324: .NET: Added static code analysis rules and suppressed warnings accordingly.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a34d7058
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a34d7058
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a34d7058
Branch: refs/heads/ignite-2454
Commit: a34d7058bd2901359cd2fda3d57a3f05ab6291df
Parents: f9868d4
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Thu Jan 28 11:25:20 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Jan 28 11:25:20 2016 +0300
----------------------------------------------------------------------
.../cpp/common/project/vs/common.vcxproj | 2 +-
.../Apache.Ignite.Benchmarks.csproj | 4 +-
.../Apache.Ignite.Core.Tests.TestDll.csproj | 4 +-
.../Apache.Ignite.Core.Tests.csproj | 2 +-
.../Apache.Ignite.Core.csproj | 8 +-
.../Apache.Ignite.Core.ruleset | 26 ++
.../Binary/BinaryConfiguration.cs | 3 +
.../Binary/BinaryTypeConfiguration.cs | 5 +
.../Binary/BinaryTypeNames.cs | 64 ++--
.../Cache/CachePartialUpdateException.cs | 3 +
.../Apache.Ignite.Core/Cache/CacheResult.cs | 41 ++-
.../Cache/Event/ICacheEntryEventFilter.cs | 1 +
.../Cache/Event/ICacheEntryEventListener.cs | 1 +
.../Cache/Query/Continuous/ContinuousQuery.cs | 2 +-
.../Apache.Ignite.Core/Cache/Query/QueryBase.cs | 2 +-
.../Cache/Query/SqlFieldsQuery.cs | 2 +-
.../Apache.Ignite.Core/Cache/Query/SqlQuery.cs | 6 +-
.../Apache.Ignite.Core/Cache/Query/TextQuery.cs | 7 +-
.../Cache/Store/CacheStoreAdapter.cs | 4 +
.../Compute/ComputeJobAdapter.cs | 2 +-
.../Compute/ComputeJobResultPolicy.cs | 2 -
.../Compute/ComputeTaskAdapter.cs | 3 +
.../Compute/ComputeTaskSplitAdapter.cs | 18 +-
.../Datastream/StreamTransformer.cs | 2 +
.../Datastream/StreamVisitor.cs | 2 +
.../Apache.Ignite.Core/Events/CacheEvent.cs | 8 +-
.../Events/CacheQueryExecutedEvent.cs | 4 +-
.../Events/CacheQueryReadEvent.cs | 6 +-
.../Events/CacheRebalancingEvent.cs | 4 +-
.../Events/CheckpointEvent.cs | 4 +-
.../Apache.Ignite.Core/Events/DiscoveryEvent.cs | 4 +-
.../Apache.Ignite.Core/Events/EventBase.cs | 70 +++-
.../dotnet/Apache.Ignite.Core/Ignition.cs | 3 +-
.../Apache.Ignite.Core/Impl/Binary/Binary.cs | 47 +--
.../Impl/Binary/BinaryFullTypeDescriptor.cs | 2 +-
.../Impl/Binary/BinaryObject.cs | 44 ++-
.../Impl/Binary/BinaryObjectBuilder.cs | 75 ++--
.../Impl/Binary/BinaryReader.cs | 1 +
.../Impl/Binary/BinaryReflectiveSerializer.cs | 2 +-
.../Impl/Binary/BinarySystemHandlers.cs | 9 +-
.../Impl/Binary/BinaryUtils.cs | 7 +-
.../Impl/Binary/BinaryWriter.cs | 3 +
.../Impl/Binary/Io/BinaryHeapStream.cs | 9 +
.../Impl/Binary/Marshaller.cs | 19 +-
.../Impl/Binary/Metadata/BinaryType.cs | 2 +
.../Impl/Binary/SerializableObjectHolder.cs | 13 +-
.../Impl/Binary/Structure/BinaryStructure.cs | 3 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 42 ++-
.../Impl/Cache/Query/AbstractQueryCursor.cs | 4 +-
.../Continuous/ContinuousQueryFilterHolder.cs | 2 +-
.../Continuous/ContinuousQueryHandleImpl.cs | 4 +-
.../Impl/Cache/Query/FieldsQueryCursor.cs | 2 +
.../Impl/Cache/Query/QueryCursor.cs | 2 +
.../Impl/Common/CancelledTask.cs | 3 +
.../Common/CopyOnWriteConcurrentDictionary.cs | 1 +
.../Impl/Common/DelegateConverter.cs | 11 +-
.../Apache.Ignite.Core/Impl/Common/Future.cs | 2 +
.../Impl/Common/LoadedAssembliesResolver.cs | 1 +
.../Closure/ComputeAbstractClosureTask.cs | 3 +
.../Compute/Closure/ComputeMultiClosureTask.cs | 2 +
.../Closure/ComputeReducingClosureTask.cs | 2 +
.../Compute/Closure/ComputeSingleClosureTask.cs | 2 +
.../Impl/Datastream/DataStreamerBatch.cs | 1 +
.../Impl/Datastream/DataStreamerImpl.cs | 5 +-
.../Apache.Ignite.Core/Impl/ExceptionUtils.cs | 56 +--
.../Impl/Handle/HandleRegistry.cs | 1 +
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 11 +-
.../Impl/InteropExceptionHolder.cs | 11 +-
.../Memory/PlatformBigEndianMemoryStream.cs | 8 +
.../Impl/Memory/PlatformMemory.cs | 2 +
.../Impl/Memory/PlatformMemoryManager.cs | 2 +
.../Impl/Memory/PlatformMemoryStream.cs | 2 +
.../Impl/Memory/PlatformRawMemory.cs | 2 +
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 3 +-
.../Impl/Resource/ResourceProcessor.cs | 2 +-
.../Impl/Resource/ResourceTypeDescriptor.cs | 2 +-
.../Impl/Services/ServiceProxy.cs | 2 +
.../Impl/Services/ServiceProxyInvoker.cs | 1 +
.../Impl/Transactions/TransactionsImpl.cs | 2 +
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 5 +-
.../Services/ServiceInvocationException.cs | 2 +
modules/platforms/dotnet/Apache.Ignite.FxCop | 354 +++----------------
modules/platforms/dotnet/Apache.Ignite.sln | 4 +-
.../Apache.Ignite.sln.TeamCity.DotSettings | 30 ++
.../dotnet/Apache.Ignite/Apache.Ignite.csproj | 5 +-
.../Apache.Ignite.Examples.csproj | 4 +-
.../Apache.Ignite.ExamplesDll.csproj | 4 +-
parent/pom.xml | 3 +-
88 files changed, 601 insertions(+), 561 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/cpp/common/project/vs/common.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/project/vs/common.vcxproj b/modules/platforms/cpp/common/project/vs/common.vcxproj
index 0fa1d0e..ac7d504 100644
--- a/modules/platforms/cpp/common/project/vs/common.vcxproj
+++ b/modules/platforms/cpp/common/project/vs/common.vcxproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj
index f4c7894..b477d17 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{8F507DBE-56F9-437F-82D4-74C02EC44E41}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Apache.Ignite.Core.Tests.TestDll.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Apache.Ignite.Core.Tests.TestDll.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Apache.Ignite.Core.Tests.TestDll.csproj
index ebc8043..ebe07eb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Apache.Ignite.Core.Tests.TestDll.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Apache.Ignite.Core.Tests.TestDll.csproj
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{F4A69E2D-908E-4F0F-A794-84D508D60E5F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index a247f63..5a1e176 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -3,7 +3,7 @@
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/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 12404be..7de8330 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -3,7 +3,7 @@
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
@@ -18,6 +18,8 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>DEBUG;CODE_ANALYSIS</DefineConstants>
<DocumentationFile>bin\x64\Debug\Apache.Ignite.Core.XML</DocumentationFile>
+ <RunCodeAnalysis>true</RunCodeAnalysis>
+ <CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
@@ -25,6 +27,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DocumentationFile>bin\x64\Release\Apache.Ignite.Core.XML</DocumentationFile>
+ <CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
@@ -32,6 +35,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>DEBUG;CODE_ANALYSIS</DefineConstants>
<DocumentationFile>bin\x86\Debug\Apache.Ignite.Core.XML</DocumentationFile>
+ <CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>x86</PlatformTarget>
@@ -39,6 +43,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DocumentationFile>bin\x86\Release\Apache.Ignite.Core.XML</DocumentationFile>
+ <CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
@@ -397,6 +402,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
+ <None Include="Apache.Ignite.Core.ruleset" />
<None Include="Apache.Ignite.Core.snk" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.ruleset
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.ruleset b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.ruleset
new file mode 100644
index 0000000..0b4f76b
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.ruleset
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RuleSet Name="Rules for Apache.Ignite.Core" Description="Code analysis rules for Apache.Ignite.Core.csproj." ToolsVersion="14.0">
+ <IncludeAll Action="Error" />
+ <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
+ <Rule Id="CA1004" Action="None" />
+ <Rule Id="CA1005" Action="None" />
+ <Rule Id="CA1006" Action="None" />
+ <Rule Id="CA1020" Action="None" />
+ <Rule Id="CA1021" Action="None" />
+ <Rule Id="CA1024" Action="None" />
+ <Rule Id="CA1026" Action="None" />
+ <Rule Id="CA1303" Action="None" />
+ <Rule Id="CA1305" Action="None" />
+ <Rule Id="CA1307" Action="None" />
+ <Rule Id="CA1502" Action="None" />
+ <Rule Id="CA1506" Action="None" />
+ <Rule Id="CA1704" Action="None" />
+ <Rule Id="CA1709" Action="None" />
+ <Rule Id="CA1716" Action="None" />
+ <Rule Id="CA1720" Action="None" />
+ <Rule Id="CA1726" Action="None" />
+ <Rule Id="CA2001" Action="None" />
+ <Rule Id="CA2204" Action="None" />
+ <Rule Id="CA2243" Action="None" />
+ </Rules>
+</RuleSet>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
index 5041a84..4d82a65 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Binary
{
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Binary type configuration.
@@ -39,6 +40,8 @@ namespace Apache.Ignite.Core.Binary
/// <param name="cfg">Configuration to copy.</param>
public BinaryConfiguration(BinaryConfiguration cfg)
{
+ IgniteArgumentCheck.NotNull(cfg, "cfg");
+
DefaultIdMapper = cfg.DefaultIdMapper;
DefaultNameMapper = cfg.DefaultNameMapper;
DefaultKeepDeserialized = cfg.DefaultKeepDeserialized;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
index 99f8572..c36b9fd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
@@ -18,6 +18,7 @@
namespace Apache.Ignite.Core.Binary
{
using System;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Binary type configuration.
@@ -47,6 +48,8 @@ namespace Apache.Ignite.Core.Binary
/// <param name="type">Type.</param>
public BinaryTypeConfiguration(Type type)
{
+ IgniteArgumentCheck.NotNull(type, "type");
+
TypeName = type.AssemblyQualifiedName;
IsEnum = type.IsEnum;
}
@@ -57,6 +60,8 @@ namespace Apache.Ignite.Core.Binary
/// <param name="cfg">Configuration to copy.</param>
public BinaryTypeConfiguration(BinaryTypeConfiguration cfg)
{
+ IgniteArgumentCheck.NotNull(cfg, "cfg");
+
AffinityKeyFieldName = cfg.AffinityKeyFieldName;
IdMapper = cfg.IdMapper;
NameMapper = cfg.NameMapper;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeNames.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeNames.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeNames.cs
index f3d4ea6..1cb0cc5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeNames.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeNames.cs
@@ -22,100 +22,100 @@ namespace Apache.Ignite.Core.Binary
/// </summary>
public static class BinaryTypeNames
{
- /** Type name: boolean. */
+ /// <summary> Type name: boolean. </summary>
public const string TypeNameBool = "boolean";
- /** Type name: byte. */
+ /// <summary> Type name: byte. </summary>
public const string TypeNameByte = "byte";
- /** Type name: short. */
+ /// <summary> Type name: short. </summary>
public const string TypeNameShort = "short";
- /** Type name: char. */
+ /// <summary> Type name: char. </summary>
public const string TypeNameChar = "char";
- /** Type name: int. */
+ /// <summary> Type name: int. </summary>
public const string TypeNameInt = "int";
- /** Type name: long. */
+ /// <summary> Type name: long. </summary>
public const string TypeNameLong = "long";
- /** Type name: float. */
+ /// <summary> Type name: float. </summary>
public const string TypeNameFloat = "float";
- /** Type name: double. */
+ /// <summary> Type name: double. </summary>
public const string TypeNameDouble = "double";
- /** Type name: decimal. */
+ /// <summary> Type name: decimal. </summary>
public const string TypeNameDecimal = "decimal";
- /** Type name: String. */
+ /// <summary> Type name: String. </summary>
public const string TypeNameString = "String";
- /** Type name: UUID. */
+ /// <summary> Type name: UUID. </summary>
public const string TypeNameGuid = "UUID";
- /** Type name: date. */
+ /// <summary> Type name: date. </summary>
public const string TypeNameDate = "Date";
- /** Type name: timestamp. */
+ /// <summary> Type name: timestamp. </summary>
public const string TypeNameTimestamp = "Timestamp";
- /** Type name: Enum. */
+ /// <summary> Type name: Enum. </summary>
public const string TypeNameEnum = "Enum";
- /** Type name: Object. */
+ /// <summary> Type name: Object. </summary>
public const string TypeNameObject = "Object";
- /** Type name: boolean array. */
+ /// <summary> Type name: boolean array. </summary>
public const string TypeNameArrayBool = "boolean[]";
- /** Type name: byte array. */
+ /// <summary> Type name: byte array. </summary>
public const string TypeNameArrayByte = "byte[]";
- /** Type name: short array. */
+ /// <summary> Type name: short array. </summary>
public const string TypeNameArrayShort = "short[]";
- /** Type name: char array. */
+ /// <summary> Type name: char array. </summary>
public const string TypeNameArrayChar = "char[]";
- /** Type name: int array. */
+ /// <summary> Type name: int array. </summary>
public const string TypeNameArrayInt = "int[]";
- /** Type name: long array. */
+ /// <summary> Type name: long array. </summary>
public const string TypeNameArrayLong = "long[]";
- /** Type name: float array. */
+ /// <summary> Type name: float array. </summary>
public const string TypeNameArrayFloat = "float[]";
- /** Type name: double array. */
+ /// <summary> Type name: double array. </summary>
public const string TypeNameArrayDouble = "double[]";
- /** Type name: decimal array. */
+ /// <summary> Type name: decimal array. </summary>
public const string TypeNameArrayDecimal = "decimal[]";
- /** Type name: String array. */
+ /// <summary> Type name: String array. </summary>
public const string TypeNameArrayString = "String[]";
- /** Type name: UUID array. */
+ /// <summary> Type name: UUID array. </summary>
public const string TypeNameArrayGuid = "UUID[]";
- /** Type name: timestamp array. */
+ /// <summary> Type name: timestamp array. </summary>
public const string TypeNameArrayDate = "Date[]";
- /** Type name: timestamp array. */
+ /// <summary> Type name: timestamp array. </summary>
public const string TypeNameArrayTimestamp = "Timestamp[]";
- /** Type name: Enum array. */
+ /// <summary> Type name: Enum array. </summary>
public const string TypeNameArrayEnum = "Enum[]";
- /** Type name: Object array. */
+ /// <summary> Type name: Object array. </summary>
public const string TypeNameArrayObject = "Object[]";
- /** Type name: Collection. */
+ /// <summary> Type name: Collection. </summary>
public const string TypeNameCollection = "Collection";
- /** Type name: Map. */
+ /// <summary> Type name: Map. </summary>
public const string TypeNameMap = "Map";
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
index b3ed537..b80913f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
@@ -19,8 +19,10 @@ namespace Apache.Ignite.Core.Cache
{
using System;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.Serialization;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Exception thrown from non-transactional cache in case when update succeeded only partially.
@@ -109,6 +111,7 @@ namespace Apache.Ignite.Core.Cache
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue(KeyFailedKeys, _failedKeys);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CacheResult.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CacheResult.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CacheResult.cs
index 75208cd..b610298 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CacheResult.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CacheResult.cs
@@ -59,13 +59,25 @@ namespace Apache.Ignite.Core.Cache
get { return _success; }
}
- /** <inehritdoc /> */
+ /// <summary>
+ /// Determines whether the specified <see cref="object" />, is equal to this instance.
+ /// </summary>
+ /// <param name="other">The <see cref="object" /> to compare with this instance.</param>
+ /// <returns>
+ /// <c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.
+ /// </returns>
public bool Equals(CacheResult<T> other)
{
return EqualityComparer<T>.Default.Equals(_value, other._value) && _success == other._success;
}
- /** <inehritdoc /> */
+ /// <summary>
+ /// Determines whether the specified <see cref="object" />, is equal to this instance.
+ /// </summary>
+ /// <param name="obj">The <see cref="object" /> to compare with this instance.</param>
+ /// <returns>
+ /// <c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.
+ /// </returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
@@ -74,7 +86,12 @@ namespace Apache.Ignite.Core.Cache
return obj is CacheResult<T> && Equals((CacheResult<T>) obj);
}
- /** <inehritdoc /> */
+ /// <summary>
+ /// Returns a hash code for this instance.
+ /// </summary>
+ /// <returns>
+ /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
+ /// </returns>
public override int GetHashCode()
{
unchecked
@@ -83,13 +100,27 @@ namespace Apache.Ignite.Core.Cache
}
}
- /** <inehritdoc /> */
+ /// <summary>
+ /// Implements the operator ==.
+ /// </summary>
+ /// <param name="left">The left.</param>
+ /// <param name="right">The right.</param>
+ /// <returns>
+ /// The result of the operator.
+ /// </returns>
public static bool operator ==(CacheResult<T> left, CacheResult<T> right)
{
return left.Equals(right);
}
- /** <inehritdoc /> */
+ /// <summary>
+ /// Implements the operator !=.
+ /// </summary>
+ /// <param name="left">The left.</param>
+ /// <param name="right">The right.</param>
+ /// <returns>
+ /// The result of the operator.
+ /// </returns>
public static bool operator !=(CacheResult<T> left, CacheResult<T> right)
{
return !left.Equals(right);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventFilter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventFilter.cs
index 98f5c5a..853619d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventFilter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventFilter.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Cache.Event
/// <summary>
/// Cache entry event filter.
/// </summary>
+ // ReSharper disable TypeParameterCanBeVariant
public interface ICacheEntryEventFilter<TK, TV>
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventListener.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventListener.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventListener.cs
index 76ae04c..f20c823 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventListener.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventListener.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Cache.Event
/// <summary>
/// Cache entry event listener.
/// </summary>
+ // ReSharper disable TypeParameterCanBeVariant
public interface ICacheEntryEventListener<TK, TV>
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
index dbf6c97..3bb136e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
@@ -47,8 +47,8 @@ namespace Apache.Ignite.Core.Cache.Query.Continuous
/// <summary>
/// Default time interval.
/// </summary>
- [SuppressMessage("ReSharper", "StaticMemberInGenericType")]
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
+ [SuppressMessage("ReSharper", "StaticMemberInGenericType")]
public static readonly TimeSpan DfltTimeInterval = new TimeSpan(0);
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
index 5bbfc1c..cf1f637 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
@@ -25,7 +25,7 @@ namespace Apache.Ignite.Core.Cache.Query
/// </summary>
public abstract class QueryBase
{
- /** Default page size. */
+ /// <summary> Default page size. </summary>
public const int DfltPageSize = 1024;
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
index c0d58ca..1753a8b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
@@ -24,7 +24,7 @@ namespace Apache.Ignite.Core.Cache.Query
/// </summary>
public class SqlFieldsQuery
{
- /** Default page size. */
+ /// <summary> Default page size. </summary>
public const int DfltPageSize = 1024;
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
index 69dc7ee..0e3c887 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Cache.Query
using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cache;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// SQL Query.
@@ -46,7 +47,7 @@ namespace Apache.Ignite.Core.Cache.Query
/// <param name="local">Whether query should be executed locally.</param>
/// <param name="args">Arguments.</param>
public SqlQuery(Type queryType, string sql, bool local, params object[] args)
- : this(queryType.Name, sql, local, args)
+ : this(queryType == null ? null : queryType.Name, sql, local, args)
{
// No-op.
}
@@ -71,6 +72,9 @@ namespace Apache.Ignite.Core.Cache.Query
/// <param name="args">Arguments.</param>
public SqlQuery(string queryType, string sql, bool local, params object[] args)
{
+ IgniteArgumentCheck.NotNullOrEmpty("queryType", queryType);
+ IgniteArgumentCheck.NotNullOrEmpty("sql", sql);
+
QueryType = queryType;
Sql = sql;
Local = local;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
index 8c7880f..e77d6e3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Cache.Query
using System;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cache;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Text query.
@@ -42,7 +43,8 @@ namespace Apache.Ignite.Core.Cache.Query
/// <param name="queryType">Type.</param>
/// <param name="text">Text.</param>
/// <param name="local">Whether query should be executed locally.</param>
- public TextQuery(Type queryType, string text, bool local) : this(queryType.Name, text, local)
+ public TextQuery(Type queryType, string text, bool local)
+ : this(queryType == null ? null : queryType.Name, text, local)
{
// No-op.
}
@@ -65,6 +67,9 @@ namespace Apache.Ignite.Core.Cache.Query
/// <param name="local">Whether query should be executed locally.</param>
public TextQuery(string queryType, string text, bool local)
{
+ IgniteArgumentCheck.NotNullOrEmpty("queryType", queryType);
+ IgniteArgumentCheck.NotNullOrEmpty("text", text);
+
QueryType = queryType;
Text = text;
Local = local;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
index fe0aeaa..3f3b558 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
@@ -19,7 +19,9 @@ namespace Apache.Ignite.Core.Cache.Store
{
using System;
using System.Collections;
+ using System.Diagnostics.CodeAnalysis;
using System.Linq;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Cache storage convenience adapter. It provides default implementation for
@@ -72,6 +74,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// Writes all.
/// </summary>
/// <param name="entries">The map.</param>
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public virtual void WriteAll(IDictionary entries)
{
foreach (DictionaryEntry entry in entries)
@@ -95,6 +98,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <param name="keys">a mutable collection of keys for entries to delete. Upon invocation,
/// it contains the keys to delete for write-through. Upon return the collection must only contain
/// the keys that were not successfully deleted.</param>
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public virtual void DeleteAll(ICollection keys)
{
foreach (object key in keys)
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
index 2a0ed4e..c53279e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
@@ -88,7 +88,7 @@ namespace Apache.Ignite.Core.Compute
public TArg GetArgument<TArg>(int idx)
{
if (_args == null || idx < 0 || idx >= _args.Length)
- throw new IndexOutOfRangeException("Invalid argument index: " + idx);
+ throw new ArgumentOutOfRangeException("Invalid argument index: " + idx);
return (TArg)_args[idx];
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
index 9807c37..6283377 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
@@ -17,8 +17,6 @@
namespace Apache.Ignite.Core.Compute
{
- using System.Collections.Generic;
-
/// <summary>
/// This enumeration provides different types of actions following the last received job result. See
/// <see cref="IComputeTask{TA,T,TR}.OnResult"/>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
index db2ab51..f2d2e14 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
@@ -19,8 +19,10 @@ namespace Apache.Ignite.Core.Compute
{
using System;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Convenience adapter for <see cref="IComputeTask{TArg,TJobRes,TTaskRes}"/> interface
@@ -42,6 +44,7 @@ namespace Apache.Ignite.Core.Compute
/// <param name="res">Received remote Ignite executable result.</param>
/// <param name="rcvd">All previously received results.</param>
/// <returns>Result policy that dictates how to process further upcoming job results.</returns>
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public virtual ComputeJobResultPolicy OnResult(IComputeJobResult<TJobRes> res,
IList<IComputeJobResult<TJobRes>> rcvd)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
index 14651b1..bc152b5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
@@ -17,11 +17,12 @@
namespace Apache.Ignite.Core.Compute
{
- using System;
using System.Collections.Generic;
- using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Compute;
/// <summary>
@@ -32,11 +33,6 @@ namespace Apache.Ignite.Core.Compute
/// </summary>
public abstract class ComputeTaskSplitAdapter<TArg, TJobRes, TTaskRes> : ComputeTaskAdapter<TArg, TJobRes, TTaskRes>
{
- /** Random generator */
- [ThreadStatic]
- // ReSharper disable once StaticMemberInGenericType
- private static Random _rnd;
-
/// <summary>
/// This is a simplified version of <see cref="IComputeTask{A,T,R}.Map"/> method.
/// <p/>
@@ -66,10 +62,9 @@ namespace Apache.Ignite.Core.Compute
/// exception will be thrown.
/// </returns>
/// <exception cref="IgniteException">Split returned no jobs.</exception>
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
override public IDictionary<IComputeJob<TJobRes>, IClusterNode> Map(IList<IClusterNode> subgrid, TArg arg)
{
- Debug.Assert(subgrid != null && subgrid.Count > 0);
-
var jobs = Split(subgrid.Count, arg);
if (jobs == null || jobs.Count == 0)
@@ -77,12 +72,11 @@ namespace Apache.Ignite.Core.Compute
var map = new Dictionary<IComputeJob<TJobRes>, IClusterNode>(jobs.Count);
- if (_rnd == null)
- _rnd = new Random();
+ var rnd = IgniteUtils.ThreadLocalRandom;
foreach (var job in jobs)
{
- int idx = _rnd.Next(subgrid.Count);
+ int idx = rnd.Next(subgrid.Count);
IClusterNode node = subgrid[idx];
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
index d50e9b1..1735c3b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
@@ -18,6 +18,7 @@
namespace Apache.Ignite.Core.Datastream
{
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Impl.Binary;
@@ -50,6 +51,7 @@ namespace Apache.Ignite.Core.Datastream
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public void Receive(ICache<TK, TV> cache, ICollection<ICacheEntry<TK, TV>> entries)
{
var keys = new List<TK>(entries.Count);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
index 5d155d7..071f7a3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Datastream
{
using System;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Impl.Common;
@@ -46,6 +47,7 @@ namespace Apache.Ignite.Core.Datastream
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public void Receive(ICache<TK, TV> cache, ICollection<ICacheEntry<TK, TV>> entries)
{
foreach (var entry in entries)
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
index 2c3230d..4c75e0a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
@@ -166,9 +166,11 @@ namespace Apache.Ignite.Core.Events
/// Gets task name if cache event was caused by an operation initiated within task execution.
/// </summary>
public string TaskName { get { return _taskName; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
+
+ /// <summary>
+ /// Gets shortened version of ToString result.
+ /// </summary>
+ public override string ToShortString()
{
return string.Format(CultureInfo.InvariantCulture,
"{0}: IsNear={1}, Key={2}, HasNewValue={3}, HasOldValue={4}, NodeId={5}", Name,
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs
index fe35793..e13a889 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs
@@ -88,7 +88,9 @@ namespace Apache.Ignite.Core.Events
/// </summary>
public string TaskName { get { return _taskName; } }
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets shortened version of ToString result.
+ /// </summary>
public override string ToShortString()
{
return string.Format(CultureInfo.InvariantCulture,
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs
index 3e02d2f..3a01395 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs
@@ -124,8 +124,10 @@ namespace Apache.Ignite.Core.Events
/// </summary>
public object Row { get { return _row; } }
- /** <inheritDoc /> */
- public override string ToShortString()
+ /// <summary>
+ /// Gets shortened version of ToString result.
+ /// </summary>
+ public override string ToShortString()
{
return string.Format(CultureInfo.InvariantCulture,
"{0}: QueryType={1}, CacheName={2}, ClassName={3}, Clause={4}, SubjectId={5}, " +
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs
index 9a648b5..31e448f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs
@@ -88,7 +88,9 @@ namespace Apache.Ignite.Core.Events
/// </summary>
public long DiscoveryTimestamp { get { return _discoveryTimestamp; } }
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets shortened version of ToString result.
+ /// </summary>
public override string ToShortString()
{
return string.Format(CultureInfo.InvariantCulture,
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs
index 1527341..5c85003 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs
@@ -42,7 +42,9 @@ namespace Apache.Ignite.Core.Events
/// </summary>
public string Key { get { return _key; } }
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets shortened version of ToString result.
+ /// </summary>
public override string ToShortString()
{
return string.Format(CultureInfo.InvariantCulture, "{0}: Key={1}", Name, Key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs
index c4d7b8e..5c163a2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs
@@ -71,7 +71,9 @@ namespace Apache.Ignite.Core.Events
/// </summary>
public ICollection<IClusterNode> TopologyNodes { get { return _topologyNodes; } }
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets shortened version of ToString result.
+ /// </summary>
public override string ToShortString()
{
return string.Format(CultureInfo.InvariantCulture,
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
index 4334158..962d577 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
@@ -19,11 +19,13 @@ namespace Apache.Ignite.Core.Events
{
using System;
using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Base event implementation.
@@ -74,55 +76,82 @@ namespace Apache.Ignite.Core.Events
_timestamp = timestamp.Value;
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets globally unique ID of this event.
+ /// </summary>
public IgniteGuid Id
{
get { return _id; }
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets locally unique ID that is atomically incremented for each event. Unlike global <see cref="Id" />
+ /// this local ID can be used for ordering events on this node.
+ /// <para />
+ /// Note that for performance considerations Ignite doesn't order events globally.
+ /// </summary>
public long LocalOrder
{
get { return _localOrder; }
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Node where event occurred and was recorded.
+ /// </summary>
public IClusterNode Node
{
get { return _node; }
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets optional message for this event.
+ /// </summary>
public string Message
{
get { return _message; }
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets type of this event. All system event types are defined in <see cref="EventType" />
+ /// </summary>
public int Type
{
get { return _type; }
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets name of this event.
+ /// </summary>
public string Name
{
get { return _name; }
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets event timestamp. Timestamp is local to the node on which this event was produced.
+ /// Note that more than one event can be generated with the same timestamp.
+ /// For ordering purposes use <see cref="LocalOrder" /> instead.
+ /// </summary>
public DateTime Timestamp
{
get { return _timestamp; }
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Gets shortened version of ToString result.
+ /// </summary>
public virtual string ToShortString()
{
return ToString();
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Determines whether the specified object is equal to this instance.
+ /// </summary>
+ /// <param name="other">The object to compare with this instance.</param>
+ /// <returns>
+ /// <c>true</c> if the specified object is equal to this instance; otherwise, <c>false</c>.
+ /// </returns>
public bool Equals(EventBase other)
{
if (ReferenceEquals(null, other)) return false;
@@ -131,7 +160,13 @@ namespace Apache.Ignite.Core.Events
return _id.Equals(other._id);
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Determines whether the specified object is equal to this instance.
+ /// </summary>
+ /// <param name="obj">The object to compare with this instance.</param>
+ /// <returns>
+ /// <c>true</c> if the specified object is equal to this instance; otherwise, <c>false</c>.
+ /// </returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
@@ -141,13 +176,23 @@ namespace Apache.Ignite.Core.Events
return Equals((EventBase) obj);
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Returns a hash code for this instance.
+ /// </summary>
+ /// <returns>
+ /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
+ /// </returns>
public override int GetHashCode()
{
return _id.GetHashCode();
}
- /** <inheritDoc /> */
+ /// <summary>
+ /// Returns a <see cref="string" /> that represents this instance.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="string" /> that represents this instance.
+ /// </returns>
public override string ToString()
{
return string.Format(CultureInfo.InvariantCulture,
@@ -159,6 +204,7 @@ namespace Apache.Ignite.Core.Events
/// </summary>
/// <param name="reader">Reader.</param>
/// <returns>Node or null.</returns>
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
protected static IClusterNode ReadNode(IBinaryRawReader reader)
{
return ((BinaryReader)reader).Marshaller.Ignite.GetNode(reader.ReadGuid());
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
index 7a3fafc..3a27ad1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
@@ -148,8 +148,7 @@ namespace Apache.Ignite.Core
var gridName = cfgEx != null ? cfgEx.GridName : null;
- var cfgPath = Environment.GetEnvironmentVariable(EnvIgniteSpringConfigUrlPrefix) +
- (cfg.SpringConfigUrl ?? DefaultCfg);
+ var cfgPath = Environment.GetEnvironmentVariable(EnvIgniteSpringConfigUrlPrefix) + cfg.SpringConfigUrl;
// 3. Create startup object which will guide us through the rest of the process.
_startup = new Startup(cfg, cbs);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
index 7062606..9b43564 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
@@ -23,7 +23,6 @@ namespace Apache.Ignite.Core.Impl.Binary
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Binary.IO;
- using Apache.Ignite.Core.Impl.Binary.Metadata;
using Apache.Ignite.Core.Impl.Common;
/// <summary>
@@ -49,25 +48,26 @@ namespace Apache.Ignite.Core.Impl.Binary
if (obj is IBinaryObject)
return (T)obj;
- IBinaryStream stream = new BinaryHeapStream(1024);
-
- // Serialize.
- BinaryWriter writer = _marsh.StartMarshal(stream);
-
- try
+ using (var stream = new BinaryHeapStream(1024))
{
- writer.Write(obj);
+ // Serialize.
+ BinaryWriter writer = _marsh.StartMarshal(stream);
+
+ try
+ {
+ writer.Write(obj);
+ }
+ finally
+ {
+ // Save metadata.
+ _marsh.FinishMarshal(writer);
+ }
+
+ // Deserialize.
+ stream.Seek(0, SeekOrigin.Begin);
+
+ return _marsh.Unmarshal<T>(stream, BinaryMode.ForceBinary);
}
- finally
- {
- // Save metadata.
- _marsh.FinishMarshal(writer);
- }
-
- // Deserialize.
- stream.Seek(0, SeekOrigin.Begin);
-
- return _marsh.Unmarshal<T>(stream, BinaryMode.ForceBinary);
}
/** <inheritDoc /> */
@@ -191,16 +191,17 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <returns>Empty binary object.</returns>
private BinaryObject BinaryFromDescriptor(IBinaryTypeDescriptor desc)
{
- var len = BinaryObjectHeader.Size;
+ const int len = BinaryObjectHeader.Size;
var hdr = new BinaryObjectHeader(desc.TypeId, 0, len, 0, len,
desc.UserType ? BinaryObjectHeader.Flag.UserType : BinaryObjectHeader.Flag.None);
- var stream = new BinaryHeapStream(len);
-
- BinaryObjectHeader.Write(hdr, stream, 0);
+ using (var stream = new BinaryHeapStream(len))
+ {
+ BinaryObjectHeader.Write(hdr, stream, 0);
- return new BinaryObject(_marsh, stream.InternalArray, 0, hdr);
+ return new BinaryObject(_marsh, stream.InternalArray, 0, hdr);
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
index 3d2b34d..ac86770 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
@@ -64,7 +64,7 @@ namespace Apache.Ignite.Core.Impl.Binary
private readonly BinaryObjectSchema _schema = new BinaryObjectSchema();
/** Enum flag. */
- private bool _isEnum;
+ private readonly bool _isEnum;
/// <summary>
/// Constructor.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
index 16f95a1..513333b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
@@ -110,11 +110,12 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <returns>Field value.</returns>
public T GetField<T>(int pos, BinaryObjectBuilder builder)
{
- IBinaryStream stream = new BinaryHeapStream(_data);
-
- stream.Seek(pos + _offset, SeekOrigin.Begin);
+ using (IBinaryStream stream = new BinaryHeapStream(_data))
+ {
+ stream.Seek(pos + _offset, SeekOrigin.Begin);
- return _marsh.Unmarshal<T>(stream, BinaryMode.ForceBinary, builder);
+ return _marsh.Unmarshal<T>(stream, BinaryMode.ForceBinary, builder);
+ }
}
/** <inheritdoc /> */
@@ -150,13 +151,16 @@ namespace Apache.Ignite.Core.Impl.Binary
{
if (_deserialized == null)
{
- IBinaryStream stream = new BinaryHeapStream(_data);
+ T res;
- stream.Seek(_offset, SeekOrigin.Begin);
+ using (IBinaryStream stream = new BinaryHeapStream(_data))
+ {
+ stream.Seek(_offset, SeekOrigin.Begin);
- T res = _marsh.Unmarshal<T>(stream, mode);
+ res = _marsh.Unmarshal<T>(stream, mode);
+ }
- IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, _header.TypeId);
+ var desc = _marsh.GetDescriptor(true, _header.TypeId);
if (!desc.KeepDeserialized)
return res;
@@ -208,11 +212,12 @@ namespace Apache.Ignite.Core.Impl.Binary
if (_fields != null)
return;
- var stream = new BinaryHeapStream(_data);
-
- var hdr = BinaryObjectHeader.Read(stream, _offset);
+ using (var stream = new BinaryHeapStream(_data))
+ {
+ var hdr = BinaryObjectHeader.Read(stream, _offset);
- _fields = hdr.ReadSchemaAsDictionary(stream, _offset) ?? EmptyFields;
+ _fields = hdr.ReadSchemaAsDictionary(stream, _offset) ?? EmptyFields;
+ }
}
/** <inheritdoc /> */
@@ -262,15 +267,16 @@ namespace Apache.Ignite.Core.Impl.Binary
// 4. Check if objects have the same raw data.
// ReSharper disable ImpureMethodCallOnReadonlyValueField (method is not impure)
- var stream = new BinaryHeapStream(_data);
- var rawOffset = _header.GetRawOffset(stream, _offset);
+ using (var stream = new BinaryHeapStream(_data))
+ using (var thatStream = new BinaryHeapStream(that._data))
+ {
+ var rawOffset = _header.GetRawOffset(stream, _offset);
+ var thatRawOffset = that._header.GetRawOffset(thatStream, that._offset);
- var thatStream = new BinaryHeapStream(that._data);
- var thatRawOffset = that._header.GetRawOffset(thatStream, that._offset);
+ return BinaryUtils.CompareArrays(_data, _offset + rawOffset, _header.Length - rawOffset,
+ that._data, that._offset + thatRawOffset, that._header.Length - thatRawOffset);
+ }
// ReSharper restore ImpureMethodCallOnReadonlyValueField
-
- return BinaryUtils.CompareArrays(_data, _offset + rawOffset, _header.Length - rawOffset,
- that._data, that._offset + thatRawOffset, that._header.Length - thatRawOffset);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
index f41514f..0f1c0bd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
@@ -352,38 +352,35 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritDoc /> */
public IBinaryObject Build()
{
- BinaryHeapStream inStream = new BinaryHeapStream(_obj.Data);
-
- inStream.Seek(_obj.Offset, SeekOrigin.Begin);
-
// Assume that resulting length will be no less than header + [fields_cnt] * 12;
int estimatedCapacity = BinaryObjectHeader.Size + (_vals == null ? 0 : _vals.Count*12);
- BinaryHeapStream outStream = new BinaryHeapStream(estimatedCapacity);
-
- BinaryWriter writer = _binary.Marshaller.StartMarshal(outStream);
+ using (var outStream = new BinaryHeapStream(estimatedCapacity))
+ {
+ BinaryWriter writer = _binary.Marshaller.StartMarshal(outStream);
- writer.SetBuilder(this);
+ writer.SetBuilder(this);
- // All related builders will work in this context with this writer.
- _parent._ctx = new Context(writer);
+ // All related builders will work in this context with this writer.
+ _parent._ctx = new Context(writer);
- try
- {
- // Write.
- writer.Write(this);
+ try
+ {
+ // Write.
+ writer.Write(this);
- // Process metadata.
- _binary.Marshaller.FinishMarshal(writer);
+ // Process metadata.
+ _binary.Marshaller.FinishMarshal(writer);
- // Create binary object once metadata is processed.
- return new BinaryObject(_binary.Marshaller, outStream.InternalArray, 0,
- BinaryObjectHeader.Read(outStream, 0));
- }
- finally
- {
- // Cleanup.
- _parent._ctx.Closed = true;
+ // Create binary object once metadata is processed.
+ return new BinaryObject(_binary.Marshaller, outStream.InternalArray, 0,
+ BinaryObjectHeader.Read(outStream, 0));
+ }
+ finally
+ {
+ // Cleanup.
+ _parent._ctx.Closed = true;
+ }
}
}
@@ -783,12 +780,13 @@ namespace Apache.Ignite.Core.Impl.Binary
internal void ProcessBinary(IBinaryStream outStream, BinaryObject port)
{
// Special case: writing binary object with correct inversions.
- BinaryHeapStream inStream = new BinaryHeapStream(port.Data);
-
- inStream.Seek(port.Offset, SeekOrigin.Begin);
+ using (var inStream = new BinaryHeapStream(port.Data))
+ {
+ inStream.Seek(port.Offset, SeekOrigin.Begin);
- // Use fresh context to ensure correct binary inversion.
- Mutate0(new Context(), inStream, outStream, false, 0, EmptyVals);
+ // Use fresh context to ensure correct binary inversion.
+ Mutate0(new Context(), inStream, outStream, false, 0, EmptyVals);
+ }
}
/// <summary>
@@ -798,18 +796,19 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="builder">Builder.</param>
internal void ProcessBuilder(IBinaryStream outStream, BinaryObjectBuilder builder)
{
- BinaryHeapStream inStream = new BinaryHeapStream(builder._obj.Data);
-
- inStream.Seek(builder._obj.Offset, SeekOrigin.Begin);
+ using (var inStream = new BinaryHeapStream(builder._obj.Data))
+ {
+ inStream.Seek(builder._obj.Offset, SeekOrigin.Begin);
- // Builder parent context might be null only in one case: if we never met this group of
- // builders before. In this case we set context to their parent and track it. Context
- // cleanup will be performed at the very end of build process.
- if (builder._parent._ctx == null || builder._parent._ctx.Closed)
- builder._parent._ctx = new Context(_parent._ctx);
+ // Builder parent context might be null only in one case: if we never met this group of
+ // builders before. In this case we set context to their parent and track it. Context
+ // cleanup will be performed at the very end of build process.
+ if (builder._parent._ctx == null || builder._parent._ctx.Closed)
+ builder._parent._ctx = new Context(_parent._ctx);
- builder.Mutate(inStream, outStream as BinaryHeapStream, builder._desc,
+ builder.Mutate(inStream, (BinaryHeapStream) outStream, builder._desc,
builder._hashCode, builder._vals);
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 105589a..1c5c719 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -538,6 +538,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
T res;
+ // ReSharper disable once CompareNonConstrainedGenericWithNull
if (!TryDeserialize(out res) && default(T) != null)
throw new BinaryObjectException(string.Format("Invalid data on deserialization. " +
"Expected: '{0}' But was: null", typeof (T)));
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializer.cs
index 0804c25..ceffef5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializer.cs
@@ -42,7 +42,7 @@ namespace Apache.Ignite.Core.Impl.Binary
internal class BinaryReflectiveSerializer : IBinarySerializer
{
/** Cached binding flags. */
- private static readonly BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public |
+ private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
/** Cached type descriptors. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
index 7596992..36e324d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -419,7 +419,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayByte);
- BinaryUtils.WriteByteArray((byte[])(Array)obj, ctx.Stream);
+ BinaryUtils.WriteByteArray((byte[]) obj, ctx.Stream);
}
/// <summary>
@@ -443,7 +443,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayShort);
- BinaryUtils.WriteShortArray((short[])(Array)obj, ctx.Stream);
+ BinaryUtils.WriteShortArray((short[]) obj, ctx.Stream);
}
/// <summary>
@@ -479,7 +479,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayInt);
- BinaryUtils.WriteIntArray((int[])(Array)obj, ctx.Stream);
+ BinaryUtils.WriteIntArray((int[]) obj, ctx.Stream);
}
/// <summary>
@@ -503,7 +503,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayLong);
- BinaryUtils.WriteLongArray((long[])(Array)obj, ctx.Stream);
+ BinaryUtils.WriteLongArray((long[]) obj, ctx.Stream);
}
/// <summary>
@@ -799,6 +799,7 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
T2 IBinarySystemReader<T2>.Read(BinaryReader ctx)
{
return _readDelegate2(ctx.Stream);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 1c85e31..06dec2c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -227,15 +227,14 @@ namespace Apache.Ignite.Core.Impl.Binary
private static readonly long JavaDateTicks = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks;
/** Bindig flags for static search. */
- private static BindingFlags _bindFlagsStatic =
- BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
+ private const BindingFlags BindFlagsStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
/** Default poratble marshaller. */
private static readonly Marshaller Marsh = new Marshaller(null);
/** Method: ReadArray. */
public static readonly MethodInfo MtdhReadArray =
- typeof(BinaryUtils).GetMethod("ReadArray", _bindFlagsStatic);
+ typeof(BinaryUtils).GetMethod("ReadArray", BindFlagsStatic);
/** Cached UTF8 encoding. */
private static readonly Encoding Utf8 = Encoding.UTF8;
@@ -1125,7 +1124,7 @@ namespace Apache.Ignite.Core.Impl.Binary
res = factory.Invoke(len);
if (adder == null)
- adder = (col, elem) => { ((ArrayList) col).Add(elem); };
+ adder = (col, elem) => ((ArrayList) col).Add(elem);
for (int i = 0; i < len; i++)
adder.Invoke(res, ctx.Deserialize<object>());
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index 189cd50..a7ce544 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -803,6 +803,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Enum value.</param>
public void WriteEnum<T>(T val)
{
+ // ReSharper disable once CompareNonConstrainedGenericWithNull
if (val == null)
WriteNullField();
else
@@ -879,6 +880,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
WriteFieldId(fieldName, BinaryUtils.TypeObject);
+ // ReSharper disable once CompareNonConstrainedGenericWithNull
if (val == null)
WriteNullField();
else
@@ -1051,6 +1053,7 @@ namespace Apache.Ignite.Core.Impl.Binary
public void Write<T>(T obj)
{
// Handle special case for null.
+ // ReSharper disable once CompareNonConstrainedGenericWithNull
if (obj == null)
{
_stream.WriteByte(BinaryUtils.HdrNull);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs
index 2265abc..1bf4d21 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryHeapStream.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
{
using System;
using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Text;
@@ -69,6 +70,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public override void WriteByteArray(byte[] val)
{
int pos0 = EnsureWriteCapacityAndShift(val.Length);
@@ -91,6 +93,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public override void WriteBoolArray(bool[] val)
{
int pos0 = EnsureWriteCapacityAndShift(val.Length);
@@ -135,6 +138,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public override void WriteShortArray(short[] val)
{
int cnt = val.Length << 1;
@@ -161,6 +165,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public override void WriteCharArray(char[] val)
{
int cnt = val.Length << 1;
@@ -220,6 +225,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public override void WriteIntArray(int[] val)
{
int cnt = val.Length << 2;
@@ -246,6 +252,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public override void WriteFloatArray(float[] val)
{
int cnt = val.Length << 2;
@@ -294,6 +301,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public override void WriteLongArray(long[] val)
{
int cnt = val.Length << 3;
@@ -320,6 +328,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritdoc /> */
+ [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
public override void WriteDoubleArray(double[] val)
{
int cnt = val.Length << 3;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index 457830f..4274744 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -112,11 +112,12 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <returns>Serialized data as byte array.</returns>
public byte[] Marshal<T>(T val)
{
- BinaryHeapStream stream = new BinaryHeapStream(128);
-
- Marshal(val, stream);
+ using (var stream = new BinaryHeapStream(128))
+ {
+ Marshal(val, stream);
- return stream.GetArrayCopy();
+ return stream.GetArrayCopy();
+ }
}
/// <summary>
@@ -170,7 +171,10 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </returns>
public T Unmarshal<T>(byte[] data, bool keepBinary)
{
- return Unmarshal<T>(new BinaryHeapStream(data), keepBinary);
+ using (var stream = new BinaryHeapStream(data))
+ {
+ return Unmarshal<T>(stream, keepBinary);
+ }
}
/// <summary>
@@ -183,7 +187,10 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </returns>
public T Unmarshal<T>(byte[] data, BinaryMode mode = BinaryMode.Deserialize)
{
- return Unmarshal<T>(new BinaryHeapStream(data), mode);
+ using (var stream = new BinaryHeapStream(data))
+ {
+ return Unmarshal<T>(stream, mode);
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
index 476e651..28dfb1a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
@@ -57,6 +57,8 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// <summary>
/// Initializes the <see cref="BinaryType"/> class.
/// </summary>
+ [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline",
+ Justification = "Readability.")]
static BinaryType()
{
TypeNames[BinaryUtils.TypeBool] = BinaryTypeNames.TypeNameBool;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
index 2da854f..08b44df 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
@@ -54,7 +54,13 @@ namespace Apache.Ignite.Core.Impl.Binary
var writer0 = (BinaryWriter)writer.GetRawWriter();
- writer0.WithDetach(w => new BinaryFormatter().Serialize(new BinaryStreamAdapter(w.Stream), Item));
+ writer0.WithDetach(w =>
+ {
+ using (var streamAdapter = new BinaryStreamAdapter(w.Stream))
+ {
+ new BinaryFormatter().Serialize(streamAdapter, Item);
+ }
+ });
}
/// <summary>
@@ -67,7 +73,10 @@ namespace Apache.Ignite.Core.Impl.Binary
var reader0 = (BinaryReader) reader.GetRawReader();
- _item = new BinaryFormatter().Deserialize(new BinaryStreamAdapter(reader0.Stream), null);
+ using (var streamAdapter = new BinaryStreamAdapter(reader0.Stream))
+ {
+ _item = new BinaryFormatter().Deserialize(streamAdapter, null);
+ }
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a34d7058/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
index 3c97877..92c841c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
@@ -86,7 +86,8 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
if (entry.IsExpected(fieldName, fieldType))
// Entry matches our expectations, return.
return entry.Id;
- else if (entry.IsJumpTable)
+
+ if (entry.IsJumpTable)
{
// Entry is a pointer to a jump table.
Debug.Assert(entry.Id < _jumps.Length);