You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/09/21 16:27:17 UTC
[21/52] [partial] ignite git commit: IGNITE-1513: Moved .Net.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterMetrics.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterMetrics.cs
deleted file mode 100644
index 4ea690c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterMetrics.cs
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * 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.Cluster
-{
- using System;
-
- /// <summary>
- /// Represents runtime information of a cluster. Apart from obvious
- /// statistical value, this information is used for implementation of
- /// load balancing, failover, and collision SPIs. For example, collision SPI
- /// in combination with fail-over SPI could check if other nodes don't have
- /// any active or waiting jobs and fail-over some jobs to those nodes.
- /// <para />
- /// Node metrics for any node can be accessed via <see cref="IClusterNode.GetMetrics"/>
- /// method. Keep in mind that there will be a certain network delay (usually
- /// equal to heartbeat delay) for the accuracy of node metrics. However, when accessing
- /// metrics on local node the metrics are always accurate and up to date.
- /// </summary>
- public interface IClusterMetrics
- {
- /// <summary>
- /// Last update time of this node metrics.
- /// </summary>
- DateTime LastUpdateTime
- {
- get;
- }
-
- /// <summary>
- /// Maximum number of jobs that ever ran concurrently on this node.
- /// </summary>
- int MaximumActiveJobs
- {
- get;
- }
-
- /// <summary>
- /// Number of currently active jobs concurrently executing on the node.
- /// </summary>
- int CurrentActiveJobs
- {
- get;
- }
-
- /// <summary>
- /// Average number of active jobs.
- /// </summary>
- float AverageActiveJobs
- {
- get;
- }
-
- /// <summary>
- /// Maximum number of waiting jobs.
- /// </summary>
- int MaximumWaitingJobs
- {
- get;
- }
-
- /// <summary>
- /// Number of queued jobs currently waiting to be executed.
- /// </summary>
- int CurrentWaitingJobs
- {
- get;
- }
-
- /// <summary>
- /// Average number of waiting jobs.
- /// </summary>
- float AverageWaitingJobs
- {
- get;
- }
-
- /// <summary>
- /// Maximum number of jobs rejected at once.
- /// </summary>
- int MaximumRejectedJobs
- {
- get;
- }
-
- /// <summary>
- /// Number of jobs rejected after more recent collision resolution operation.
- /// </summary>
- int CurrentRejectedJobs
- {
- get;
- }
-
- /// <summary>
- /// Average number of jobs this node rejects during collision resolution operations.
- /// </summary>
- float AverageRejectedJobs
- {
- get;
- }
-
- /// <summary>
- /// Total number of jobs this node rejects during collision resolution operations since node startup.
- /// </summary>
- int TotalRejectedJobs
- {
- get;
- }
-
- /// <summary>
- /// Maximum number of cancelled jobs ever had running concurrently.
- /// </summary>
- int MaximumCancelledJobs
- {
- get;
- }
-
- /// <summary>
- /// Number of cancelled jobs that are still running.
- /// </summary>
- int CurrentCancelledJobs
- {
- get;
- }
-
- /// <summary>
- /// Average number of cancelled jobs.
- /// </summary>
- float AverageCancelledJobs
- {
- get;
- }
-
- /// <summary>
- /// Total number of cancelled jobs since node startup.
- /// </summary>
- int TotalCancelledJobs
- {
- get;
- }
-
- /// <summary>
- /// Total number of jobs handled by the node since node startup.
- /// </summary>
- int TotalExecutedJobs
- {
- get;
- }
-
- /// <summary>
- /// Maximum time a job ever spent waiting in a queue to be executed.
- /// </summary>
- long MaximumJobWaitTime
- {
- get;
- }
-
- /// <summary>
- /// Current time an oldest jobs has spent waiting to be executed.
- /// </summary>
- long CurrentJobWaitTime
- {
- get;
- }
-
- /// <summary>
- /// Average time jobs spend waiting in the queue to be executed.
- /// </summary>
- double AverageJobWaitTime
- {
- get;
- }
-
- /// <summary>
- /// Time it took to execute the longest job on the node.
- /// </summary>
- long MaximumJobExecuteTime
- {
- get;
- }
-
- /// <summary>
- /// Longest time a current job has been executing for.
- /// </summary>
- long CurrentJobExecuteTime
- {
- get;
- }
-
- /// <summary>
- /// Average job execution time.
- /// </summary>
- double AverageJobExecuteTime
- {
- get;
- }
-
- /// <summary>
- /// Total number of jobs handled by the node.
- /// </summary>
- int TotalExecutedTasks
- {
- get;
- }
-
- /// <summary>
- /// Total time this node spent executing jobs.
- /// </summary>
- long TotalBusyTime
- {
- get;
- }
-
- /// <summary>
- /// Total time this node spent idling.
- /// </summary>
- long TotalIdleTime
- {
- get;
- }
-
- /// <summary>
- /// Time this node spend idling since executing last job.
- /// </summary>
- long CurrentIdleTime
- {
- get;
- }
-
- /// <summary>
- /// Percentage of time this node is busy.
- /// </summary>
- float BusyTimePercentage
- {
- get;
- }
-
- /// <summary>
- /// Percentage of time this node is idle
- /// </summary>
- float IdleTimePercentage
- {
- get;
- }
-
- /// <summary>
- /// Returns the number of CPUs available to the Java Virtual Machine.
- /// </summary>
- int TotalCpus
- {
- get;
- }
-
- /// <summary>
- /// Returns the CPU usage usage in [0, 1] range.
- /// </summary>
- double CurrentCpuLoad
- {
- get;
- }
-
- /// <summary>
- /// Average of CPU load values in [0, 1] range over all metrics kept in the history.
- /// </summary>
- double AverageCpuLoad
- {
- get;
- }
-
- /// <summary>
- /// Average time spent in CG since the last update.
- /// </summary>
- double CurrentGcCpuLoad
- {
- get;
- }
-
- /// <summary>
- /// Amount of heap memory in bytes that the JVM
- /// initially requests from the operating system for memory management.
- /// This method returns <code>-1</code> if the initial memory size is undefined.
- /// <para />
- /// This value represents a setting of the heap memory for Java VM and is
- /// not a sum of all initial heap values for all memory pools.
- /// </summary>
- long HeapMemoryInitialized
- {
- get;
- }
-
- /// <summary>
- /// Current heap size that is used for object allocation.
- /// The heap consists of one or more memory pools. This value is
- /// the sum of used heap memory values of all heap memory pools.
- /// <para />
- /// The amount of used memory in the returned is the amount of memory
- /// occupied by both live objects and garbage objects that have not
- /// been collected, if any.
- /// </summary>
- long HeapMemoryUsed
- {
- get;
- }
-
- /// <summary>
- /// Amount of heap memory in bytes that is committed for the JVM to use. This amount of memory is
- /// guaranteed for the JVM to use. The heap consists of one or more memory pools. This value is
- /// the sum of committed heap memory values of all heap memory pools.
- /// </summary>
- long HeapMemoryCommitted
- {
- get;
- }
-
- /// <summary>
- /// Mmaximum amount of heap memory in bytes that can be used for memory management.
- /// This method returns <code>-1</code> if the maximum memory size is undefined.
- /// <para />
- /// This amount of memory is not guaranteed to be available for memory management if
- /// it is greater than the amount of committed memory. The JVM may fail to allocate
- /// memory even if the amount of used memory does not exceed this maximum size.
- /// <para />
- /// This value represents a setting of the heap memory for Java VM and is
- /// not a sum of all initial heap values for all memory pools.
- /// </summary>
- long HeapMemoryMaximum
- {
- get;
- }
-
- /// <summary>
- /// Total amount of heap memory in bytes. This method returns <code>-1</code>
- /// if the total memory size is undefined.
- /// <para />
- /// This amount of memory is not guaranteed to be available for memory management if it is
- /// greater than the amount of committed memory. The JVM may fail to allocate memory even
- /// if the amount of used memory does not exceed this maximum size.
- /// <para />
- /// This value represents a setting of the heap memory for Java VM and is
- /// not a sum of all initial heap values for all memory pools.
- /// </summary>
- long HeapMemoryTotal
- {
- get;
- }
-
- /// <summary>
- /// Amount of non-heap memory in bytes that the JVM initially requests from the operating
- /// system for memory management.
- /// </summary>
- long NonHeapMemoryInitialized
- {
- get;
- }
-
- /// <summary>
- /// Current non-heap memory size that is used by Java VM.
- /// </summary>
- long NonHeapMemoryUsed
- {
- get;
- }
-
- /// <summary>
- /// Amount of non-heap memory in bytes that is committed for the JVM to use.
- /// </summary>
- long NonHeapMemoryCommitted
- {
- get;
- }
-
- /// <summary>
- /// Maximum amount of non-heap memory in bytes that can be used for memory management.
- /// </summary>
- long NonHeapMemoryMaximum
- {
- get;
- }
-
- /// <summary>
- /// Total amount of non-heap memory in bytes that can be used for memory management.
- /// </summary>
- long NonHeapMemoryTotal
- {
- get;
- }
-
- /// <summary>
- /// Uptime of the JVM in milliseconds.
- /// </summary>
- long UpTime
- {
- get;
- }
-
- /// <summary>
- /// Start time of the JVM in milliseconds.
- /// </summary>
- DateTime StartTime
- {
- get;
- }
-
- /// <summary>
- /// Start time of the Ignite node in milliseconds.
- /// </summary>
- DateTime NodeStartTime
- {
- get;
- }
-
- /// <summary>
- /// Current number of live threads.
- /// </summary>
- int CurrentThreadCount
- {
- get;
- }
-
- /// <summary>
- /// The peak live thread count.
- /// </summary>
- int MaximumThreadCount
- {
- get;
- }
-
- /// <summary>
- /// The total number of threads started.
- /// </summary>
- long TotalStartedThreadCount
- {
- get;
- }
-
- /// <summary>
- /// Current number of live daemon threads.
- /// </summary>
- int CurrentDaemonThreadCount
- {
- get;
- }
-
- /// <summary>
- /// Ignite assigns incremental versions to all cache operations. This property provides
- /// the latest data version on the node.
- /// </summary>
- long LastDataVersion
- {
- get;
- }
-
- /// <summary>
- /// Sent messages count
- /// </summary>
- int SentMessagesCount
- {
- get;
- }
-
- /// <summary>
- /// Sent bytes count.
- /// </summary>
- long SentBytesCount
- {
- get;
- }
-
- /// <summary>
- /// Received messages count.
- /// </summary>
- int ReceivedMessagesCount
- {
- get;
- }
-
- /// <summary>
- /// Received bytes count.
- /// </summary>
- long ReceivedBytesCount
- {
- get;
- }
-
- /// <summary>
- /// Outbound messages queue size.
- /// </summary>
- int OutboundMessagesQueueSize
- {
- get;
- }
-
- /// <summary>
- /// Gets total number of nodes.
- /// </summary>
- int TotalNodes
- {
- get;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs
deleted file mode 100644
index 11b4c4a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.Cluster
-{
- using System;
- using System.Collections.Generic;
-
- /// <summary>
- /// Interface representing a single cluster node. Use <see cref="GetAttribute{T}"/> or
- /// <see cref="GetMetrics"/> to get static and dynamic information about remote nodes.
- /// You can get a list of all nodes in grid by calling <see cref="IClusterGroup.GetNodes"/>
- /// on <see cref="IIgnite"/> instance.
- /// <para />
- /// You can use Ignite node attributes to provide static information about a node.
- /// This information is initialized once within grid, during node startup, and
- /// remains the same throughout the lifetime of a node.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface IClusterNode
- {
- /// <summary>
- /// Globally unique node ID. A new ID is generated every time a node restarts.
- /// </summary>
- Guid Id { get; }
-
- /// <summary>
- /// Gets node's attribute. Attributes are assigned to nodes at startup.
- /// <para />
- /// Note that attributes cannot be changed at runtime.
- /// </summary>
- /// <param name="name">Attribute name.</param>
- /// <returns>Attribute value.</returns>
- T GetAttribute<T>(string name);
-
- /// <summary>
- /// Try getting node's attribute. Attributes are assigned to nodes at startup.
- /// <para />
- /// Note that attributes cannot be changed at runtime.
- /// </summary>
- /// <param name="name">Attribute name.</param>
- /// <param name="attr">Attribute value.</param>
- /// <returns><code>true</code> in case such attribute exists.</returns>
- bool TryGetAttribute<T>(string name, out T attr);
-
- /// <summary>
- /// Gets all node attributes. Attributes are assigned to nodes at startup.
- /// <para />
- /// Note that attributes cannot be changed at runtime.
- /// </summary>
- /// <returns>All node attributes.</returns>
- IDictionary<string, object> GetAttributes();
-
- /// <summary>
- /// Collection of addresses this node is known by.
- /// </summary>
- /// <returns>Collection of addresses.</returns>
- ICollection<string> Addresses { get; }
-
- /// <summary>
- /// Collection of host names this node is known by.
- /// </summary>
- /// <returns>Collection of host names.</returns>
- ICollection<string> HostNames { get; }
-
- /// <summary>
- /// Node order within grid topology. Discovery SPIs that support node ordering will
- /// assign a proper order to each node and will guarantee that discovery event notifications
- /// for new nodes will come in proper order. All other SPIs not supporting ordering
- /// may choose to return node startup time here.
- /// </summary>
- long Order { get; }
-
- /// <summary>
- /// Tests whether or not this node is a local node.
- /// </summary>
- bool IsLocal { get; }
-
- /// <summary>
- /// Tests whether or not this node is a daemon.
- /// <p/>
- /// Daemon nodes are the usual Ignite nodes that participate in topology but not
- /// visible on the main APIs, i.e. they are not part of any projections.
- /// <p/>
- /// Daemon nodes are used primarily for management and monitoring functionality that
- /// is build on Ignite and needs to participate in the topology but should be
- /// excluded from "normal" topology so that it won't participate in task execution
- /// or in-memory database.
- /// <p/>
- /// Application code should never use daemon nodes.
- /// </summary>
- bool IsDaemon { get; }
-
- /// <summary>
- /// Gets metrics snapshot for this node. Note that node metrics are constantly updated
- /// and provide up to date information about nodes. For example, you can get
- /// an idea about CPU load on remote node via <see cref="IClusterMetrics.CurrentCpuLoad"/>.
- /// <para/>
- /// Node metrics are updated with some delay which is directly related to heartbeat
- /// frequency. For example, when used with default <code>GridTcpDiscoverySpi</code> the
- /// update will happen every <code>2</code> seconds.
- /// </summary>
- /// <returns>Runtime metrics snapshot for this node.</returns>
- IClusterMetrics GetMetrics();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNodeFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNodeFilter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNodeFilter.cs
deleted file mode 100644
index 77eefbb..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNodeFilter.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.Cluster
-{
- /// <summary>
- /// Represents cluster node filter.
- /// </summary>
- public interface IClusterNodeFilter
- {
- /// <summary>
- /// Returns a value indicating whether provided node satisfies this predicate.
- /// </summary>
- /// <param name="node">Cluster node.</param>
- /// <returns>Value indicating whether provided node satisfies this predicate.</returns>
- bool Invoke(IClusterNode node);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/AsyncSupportedAttribute.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/AsyncSupportedAttribute.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/AsyncSupportedAttribute.cs
deleted file mode 100644
index 094a93c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/AsyncSupportedAttribute.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.Common
-{
- using System;
-
- /// <summary>
- /// Attribute to indicate that method can be executed asynchronously if async mode is enabled.
- /// To enable async mode, invoke <see cref="IAsyncSupport{TWithAsync}.WithAsync"/> method on the API.
- /// The future for the async method can be retrieved via
- /// <see cref="IFuture{T}"/> right after the execution of an asynchronous method.
- /// </summary>
- [AttributeUsage(AttributeTargets.Method)]
- public sealed class AsyncSupportedAttribute : Attribute
- {
- // No-op.
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IAsyncSupport.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IAsyncSupport.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IAsyncSupport.cs
deleted file mode 100644
index ee98c5a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IAsyncSupport.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.Common
-{
- /// <summary>
- /// Allows to enable asynchronous mode on Ignite APIs.
- /// </summary>
- /// <typeparam name="TWithAsync">Type of WithAsync method result.</typeparam>
- public interface IAsyncSupport<out TWithAsync> where TWithAsync : IAsyncSupport<TWithAsync>
- {
- /// <summary>
- /// Gets component with asynchronous mode enabled.
- /// </summary>
- /// <returns>Component with asynchronous mode enabled.</returns>
- TWithAsync WithAsync();
-
- /// <summary>
- /// Gets a value indicating whether this instance is in asynchronous mode.
- /// </summary>
- /// <value>
- /// <c>true</c> if asynchronous mode is enabled.
- /// </value>
- bool IsAsync { get; }
-
- /// <summary>
- /// Gets and resets future for previous asynchronous operation.
- /// </summary>
- /// <returns>Future for previous asynchronous operation.</returns>
- IFuture GetFuture();
-
- /// <summary>
- /// Gets and resets future for previous asynchronous operation.
- /// </summary>
- /// <returns>Future for previous asynchronous operation.</returns>
- IFuture<TResult> GetFuture<TResult>();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IFuture.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IFuture.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IFuture.cs
deleted file mode 100644
index 2e94cd4..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IFuture.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.Common
-{
- using System;
- using System.Threading.Tasks;
-
- /// <summary>
- /// Non-generic Future. Represents an asynchronous operation that can return a value.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface IFuture
- {
- /// <summary>
- /// Gets a value indicating whether this instance is done.
- /// </summary>
- bool IsDone
- {
- get;
- }
-
- /// <summary>
- /// Gets the future result.
- /// </summary>
- /// <returns>Future result.</returns>
- object Get();
-
- /// <summary>
- /// Gets the future result with a timeout.
- /// </summary>
- /// <param name="timeout">The timeout.</param>
- /// <returns>
- /// Future result, if it is obtained within specified timeout; otherwise, throws <see cref="TimeoutException"/>
- /// </returns>
- /// <exception cref="TimeoutException">Thrown if Get operation exceeded specified timeout.</exception>
- object Get(TimeSpan timeout);
-
- /// <summary>
- /// Listens this instance and invokes callback upon future completion.
- /// </summary>
- /// <param name="callback">The callback to execute upon future completion.</param>
- void Listen(Action callback);
-
- /// <summary>
- /// Listens this instance and invokes callback upon future completion.
- /// </summary>
- /// <param name="callback">The callback to execute upon future completion.</param>
- void Listen(Action<IFuture> callback);
-
- /// <summary>
- /// Gets an IAsyncResult indicating the state of this Future.
- /// </summary>
- /// <returns>Future state representation in form of IAsyncResult.</returns>
- IAsyncResult ToAsyncResult();
-
- /// <summary>
- /// Gets a Task that returns the result of this Future.
- /// </summary>
- /// <returns>Task that completes when this future gets done and returns the result.</returns>
- Task<object> ToTask();
- }
-
- /// <summary>
- /// Generic Future. Represents an asynchronous operation that can return a value.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- /// <typeparam name="T">Future result type.</typeparam>
- public interface IFuture<T> : IFuture
- {
- /// <summary>
- /// Gets the future result.
- /// </summary>
- /// <returns>Future result.</returns>
- new T Get();
-
- /// <summary>
- /// Gets the future result with a timeout.
- /// </summary>
- /// <param name="timeout">The timeout.</param>
- /// <returns>
- /// Future result, if it is obtained within specified timeout; otherwise, throws <see cref="TimeoutException"/>
- /// </returns>
- /// <exception cref="TimeoutException">Thrown if Get operation exceeded specified timeout.</exception>
- new T Get(TimeSpan timeout);
-
- /// <summary>
- /// Gets a Task that returns the result of this Future.
- /// </summary>
- /// <returns>Task that completes when this future gets done and returns the result.</returns>
- new Task<T> ToTask();
-
- /// <summary>
- /// Listens this instance and invokes callback upon future completion.
- /// </summary>
- /// <param name="callback">The callback to execute upon future completion.</param>
- void Listen(Action<IFuture<T>> callback);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteException.cs
deleted file mode 100644
index 98e5389..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteException.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.Common
-{
- using System;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// General Ignite exception. Indicates any error condition within Ignite.
- /// </summary>
- [Serializable]
- public class IgniteException : Exception
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteException"/> class.
- /// </summary>
- public IgniteException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteException" /> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public IgniteException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteException" /> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public IgniteException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected IgniteException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
deleted file mode 100644
index 53c7151..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.Common
-{
- using System;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Ignite guid with additional local ID.
- /// </summary>
- public struct IgniteGuid : IEquatable<IgniteGuid>
- {
- /** Global id. */
- private readonly Guid _globalId;
-
- /** Local id. */
- private readonly long _localId;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteGuid"/> struct.
- /// </summary>
- /// <param name="globalId">The global id.</param>
- /// <param name="localId">The local id.</param>
- public IgniteGuid(Guid globalId, long localId)
- {
- _globalId = globalId;
- _localId = localId;
- }
-
- /// <summary>
- /// Gets the global id.
- /// </summary>
- public Guid GlobalId
- {
- get { return _globalId; }
- }
-
- /// <summary>
- /// Gets the local id.
- /// </summary>
- public long LocalId
- {
- get { return _localId; }
- }
-
- /** <inheritDoc /> */
- public bool Equals(IgniteGuid other)
- {
- return _globalId.Equals(other._globalId) && _localId == other._localId;
- }
-
- /** <inheritDoc /> */
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- return obj is IgniteGuid && Equals((IgniteGuid) obj);
- }
-
- /** <inheritDoc /> */
- public override int GetHashCode()
- {
- unchecked
- {
- return (_globalId.GetHashCode() * 397) ^ _localId.GetHashCode();
- }
- }
-
- /** <inheritDoc /> */
- public override string ToString()
- {
- return string.Format("IgniteGuid [GlobalId={0}, LocalId={1}]", GlobalId, LocalId);
- }
-
- /// <summary>
- /// Writes this object to the given writer.
- /// </summary>
- /// <param name="w">Writer.</param>
- public void WritePortable(IPortableRawWriter w)
- {
- w.WriteGuid(GlobalId);
- w.WriteLong(LocalId);
- }
-
- /// <summary>
- /// Reads this object from the given reader.
- /// </summary>
- /// <param name="r">Reader.</param>
- public static IgniteGuid ReadPortable(IPortableRawReader r)
- {
- var guid = r.ReadGuid();
-
- return guid == null
- ? new IgniteGuid(Guid.Empty, 0)
- : new IgniteGuid(guid.Value, r.ReadLong());
- }
-
- /// <summary>
- /// Implements the operator ==.
- /// </summary>
- /// <param name="a">First item.</param>
- /// <param name="b">Second item.</param>
- /// <returns>
- /// The result of the operator.
- /// </returns>
- public static bool operator ==(IgniteGuid a, IgniteGuid b)
- {
- return a.Equals(b);
- }
-
- /// <summary>
- /// Implements the operator !=.
- /// </summary>
- /// <param name="a">First item.</param>
- /// <param name="b">Second item.</param>
- /// <returns>
- /// The result of the operator.
- /// </returns>
- public static bool operator !=(IgniteGuid a, IgniteGuid b)
- {
- return !(a == b);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeExecutionRejectedException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeExecutionRejectedException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeExecutionRejectedException.cs
deleted file mode 100644
index 108d396..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeExecutionRejectedException.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Indicates a situation when execution service provided by the user in configuration rejects execution.
- /// </summary>
- [Serializable]
- public class ComputeExecutionRejectedException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeExecutionRejectedException"/> class.
- /// </summary>
- public ComputeExecutionRejectedException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeExecutionRejectedException" /> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeExecutionRejectedException(string message)
- : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeExecutionRejectedException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeExecutionRejectedException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeExecutionRejectedException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeExecutionRejectedException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
deleted file mode 100644
index 92c6492..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.Compute
-{
- using System;
-
- /// <summary>
- /// Convenience adapter for <see cref="IComputeJob{T}"/> implementations. It provides the following functionality:
- /// <ul>
- /// <li>
- /// Default implementation of <see cref="IComputeJob{T}.Cancel()"/> method and ability
- /// to check whether cancellation occurred with <see cref="ComputeJobAdapter{T}.IsCancelled()"/> method.
- /// </li>
- /// <li>
- /// Ability to set and get job arguments via <see cref="ComputeJobAdapter{T}.SetArguments(object[])"/>
- /// and <see cref="ComputeJobAdapter{T}.Argument{T}(int)"/> methods.
- /// </li>
- /// </ul>
- /// </summary>
- [Serializable]
- public abstract class ComputeJobAdapter<T> : IComputeJob<T>
- {
- /** Cancelled flag */
- [NonSerialized]
- private volatile bool _cancelled;
-
- /** Arguments. */
- protected object[] Args;
-
- /// <summary>
- /// No-arg constructor.
- /// </summary>
- protected ComputeJobAdapter()
- {
- // No-op.
- }
-
- /// <summary>
- /// Creates job with specified arguments.
- /// </summary>
- /// <param name="args">Optional job arguments.</param>
- protected ComputeJobAdapter(params object[] args)
- {
- Args = args;
- }
-
- /// <summary>
- /// This method is called when system detects that completion of this
- /// job can no longer alter the overall outcome (for example, when parent task
- /// has already reduced the results).
- /// <para />
- /// Note that job cancellation is only a hint, and it is really up to the actual job
- /// instance to gracefully finish execution and exit.
- /// </summary>
- public void Cancel()
- {
- _cancelled = true;
- }
-
- /// <summary>
- /// Sets given arguments.
- /// </summary>
- /// <param name="args">Optional job arguments to set.</param>
- public void SetArguments(params object[] args)
- {
- Args = args;
- }
-
- /// <summary>
- /// Sets given arguments.
- /// </summary>
- /// <param name="idx">Index of the argument.</param>
- public TArg Argument<TArg>(int idx)
- {
- if (idx < 0 || idx >= Args.Length)
- throw new ArgumentException("Invalid argument index: " + idx);
-
- return (TArg)Args[idx];
- }
-
- /// <summary>
- /// This method tests whether or not this job was cancelled. This method
- /// is thread-safe and can be called without extra synchronization.
- /// <p/>
- /// This method can be periodically called in <see cref="IComputeJob{T}.Execute()"/> method
- /// implementation to check whether or not this job cancelled. Note that system
- /// calls <see cref="IComputeJob{T}.Cancel()"/> method only as a hint and this is a responsibility of
- /// the implementation of the job to properly cancel its execution.
- /// </summary>
- /// <returns><c>True</c> if this job was cancelled, <c>false</c> otherwise.</returns>
- protected bool IsCancelled()
- {
- return _cancelled;
- }
-
- /// <summary>
- /// Executes this job.
- /// </summary>
- /// <returns>
- /// Job execution result (possibly <c>null</c>). This result will be returned
- /// in <see cref="IComputeJobResult{T}" /> object passed into
- /// <see cref="IComputeTask{A,T,R}.Result" />
- /// on caller node.
- /// </returns>
- public abstract T Execute();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobFailoverException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobFailoverException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobFailoverException.cs
deleted file mode 100644
index 970bd43..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobFailoverException.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// This runtime exception can be thrown from <see cref="IComputeJob{T}.Execute()"/>
- /// method to force job failover to another node within task topology.
- /// <see cref="IComputeFunc{T,R}"/> or <see cref="IComputeFunc{T}"/>
- /// passed into any of the <see cref="ICompute"/> methods can also throw this exception
- /// to force failover.
- /// </summary>
- [Serializable]
- public class ComputeJobFailoverException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobFailoverException"/> class.
- /// </summary>
- public ComputeJobFailoverException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobFailoverException" /> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeJobFailoverException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobFailoverException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeJobFailoverException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobFailoverException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeJobFailoverException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
deleted file mode 100644
index 6fa0808..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.Compute
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// This enumeration provides different types of actions following the last received job result. See
- /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/>
- /// for more details.
- /// </summary>
- public enum ComputeJobResultPolicy
- {
- /// <summary>
- /// Wait for results if any are still expected. If all results have been received -
- /// it will start reducing results.
- /// </summary>
- Wait = 0,
-
- /// <summary>
- /// Ignore all not yet received results and start reducing results.
- /// </summary>
- Reduce = 1,
-
- /// <summary>
- /// Fail-over job to execute on another node.
- /// </summary>
- Failover = 2
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
deleted file mode 100644
index 67f7432..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Convenience adapter for <see cref="IComputeTask{A,T,R}"/> interface
- /// </summary>
- public abstract class ComputeTaskAdapter<TA, T, TR> : IComputeTask<TA, T, TR>
- {
- /// <summary>
- /// Default implementation which will wait for all jobs to complete before
- /// calling <see cref="IComputeTask{A,T,R}.Reduce"/> method.
- /// <p/>
- /// If remote job resulted in exception <see cref="IComputeJobResult{T}.Exception()"/>
- /// is not <c>null</c>),
- /// then <see cref="ComputeJobResultPolicy.Failover"/> policy will be returned if
- /// the exception is instance of <see cref="ClusterTopologyException"/>
- /// or <see cref="ComputeExecutionRejectedException"/>, which means that
- /// remote node either failed or job execution was rejected before it got a chance to start. In all
- /// other cases the exception will be rethrown which will ultimately cause task to fail.
- /// </summary>
- /// <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>
- public virtual ComputeJobResultPolicy Result(IComputeJobResult<T> res, IList<IComputeJobResult<T>> rcvd)
- {
- Exception err = res.Exception();
-
- if (err != null)
- {
- if (err is ComputeExecutionRejectedException || err is ClusterTopologyException ||
- err is ComputeJobFailoverException)
- return ComputeJobResultPolicy.Failover;
-
- throw new IgniteException("Remote job threw user exception (override or implement IComputeTask.result(..) " +
- "method if you would like to have automatic failover for this exception).", err);
- }
-
- return ComputeJobResultPolicy.Wait;
- }
-
- /// <summary>
- /// This method is called to map or split Ignite task into multiple Ignite jobs. This is the
- /// first method that gets called when task execution starts.
- /// </summary>
- /// <param name="subgrid">Nodes available for this task execution. Note that order of nodes is
- /// guaranteed to be randomized by container. This ensures that every time you simply iterate
- /// through Ignite nodes, the order of nodes will be random which over time should result into
- /// all nodes being used equally.</param>
- /// <param name="arg">Task execution argument. Can be <c>null</c>. This is the same argument
- /// as the one passed into <c>ICompute.Execute()</c> methods.</param>
- /// <returns>
- /// Map of Ignite jobs assigned to subgrid node. If <c>null</c> or empty map is returned,
- /// exception will be thrown.
- /// </returns>
- public abstract IDictionary<IComputeJob<T>, IClusterNode> Map(IList<IClusterNode> subgrid, TA arg);
-
- /// <summary>
- /// Reduces (or aggregates) results received so far into one compound result to be returned to
- /// caller via future.
- /// <para />
- /// Note, that if some jobs did not succeed and could not be failed over then the list of
- /// results passed into this method will include the failed results. Otherwise, failed
- /// results will not be in the list.
- /// </summary>
- /// <param name="results">Received job results. Note that if task class has
- /// <see cref="ComputeTaskNoResultCacheAttribute" /> attribute, then this list will be empty.</param>
- /// <returns>
- /// Task result constructed from results of remote executions.
- /// </returns>
- public abstract TR Reduce(IList<IComputeJobResult<T>> results);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskCancelledException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskCancelledException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskCancelledException.cs
deleted file mode 100644
index 460e9b0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskCancelledException.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// This exception indicates that Ignite task was cancelled.
- /// </summary>
- [Serializable]
- public class ComputeTaskCancelledException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskCancelledException"/> class.
- /// </summary>
- public ComputeTaskCancelledException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskCancelledException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeTaskCancelledException(string message)
- : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskCancelledException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeTaskCancelledException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskCancelledException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeTaskCancelledException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs
deleted file mode 100644
index a58aa87..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.Compute
-{
- using System;
-
- /// <summary>
- /// This attribute disables caching of task results when attached to <see cref="IComputeTask{A,T,R}"/>
- /// instance. Use it when number of jobs within task grows too big, or jobs themselves are too large
- /// to keep in memory throughout task execution. By default all results are cached and passed into
- /// <see cref="IComputeTask{A,T,R}.Result"/>
- /// and <see cref="IComputeTask{A,T,R}.Reduce"/> methods. When this
- /// attribute is attached to a task class, then this list of job results will always be empty.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
- public sealed class ComputeTaskNoResultCacheAttribute : Attribute
- {
- // No-op.
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
deleted file mode 100644
index bf4685a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.Compute
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Compute;
-
- /// <summary>
- /// This class defines simplified adapter for <see cref="IComputeTask{A,T,R}"/>. This adapter can be used
- /// when jobs can be randomly assigned to available Ignite nodes. This adapter is sufficient
- /// in most homogeneous environments where all nodes are equally suitable for executing grid
- /// job, see <see cref="Split"/> method for more details.
- /// </summary>
- public abstract class ComputeTaskSplitAdapter<TA, T, TR> : ComputeTaskAdapter<TA, T, TR>
- {
- /** 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/>
- /// This method basically takes given argument and splits it into a collection
- /// of <see cref="IComputeJob"/> using provided grid size as indication of how many node are
- /// available. These jobs will be randomly mapped to available Ignite nodes. Note that
- /// if number of jobs is greater than number of Ignite nodes (i.e, grid size), the grid
- /// nodes will be reused and some jobs will end up on the same Ignite nodes.
- /// </summary>
- /// <param name="gridSize">Number of available Ignite nodes. Note that returned number of jobs can be less,
- /// equal or greater than this grid size.</param>
- /// <param name="arg">Task execution argument. Can be <c>null</c>.</param>
- protected abstract ICollection<IComputeJob<T>> Split(int gridSize, TA arg);
-
- /// <summary>
- /// This method is called to map or split Ignite task into multiple Ignite jobs. This is the
- /// first method that gets called when task execution starts.
- /// </summary>
- /// <param name="subgrid">Nodes available for this task execution. Note that order of nodes is
- /// guaranteed to be randomized by container. This ensures that every time you simply iterate
- /// through Ignite nodes, the order of nodes will be random which over time should result into
- /// all nodes being used equally.</param>
- /// <param name="arg">Task execution argument. Can be <c>null</c>. This is the same argument
- /// as the one passed into <c>ICompute.Execute()</c> methods.</param>
- /// <returns>
- /// Map of Ignite jobs assigned to subgrid node. If <c>null</c> or empty map is returned,
- /// exception will be thrown.
- /// </returns>
- /// <exception cref="IgniteException">Split returned no jobs.</exception>
- override public IDictionary<IComputeJob<T>, IClusterNode> Map(IList<IClusterNode> subgrid, TA arg)
- {
- Debug.Assert(subgrid != null && subgrid.Count > 0);
-
- var jobs = Split(subgrid.Count, arg);
-
- if (jobs == null || jobs.Count == 0)
- throw new IgniteException("Split returned no jobs.");
-
- var map = new Dictionary<IComputeJob<T>, IClusterNode>(jobs.Count);
-
- if (_rnd == null)
- _rnd = new Random();
-
- foreach (var job in jobs)
- {
- int idx = _rnd.Next(subgrid.Count);
-
- IClusterNode node = subgrid[idx];
-
- map[job] = node;
- }
-
- return map;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskTimeoutException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskTimeoutException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskTimeoutException.cs
deleted file mode 100644
index 71fc568..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskTimeoutException.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Indicates that task execution timed out.
- /// </summary>
- [Serializable]
- public class ComputeTaskTimeoutException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskTimeoutException"/> class.
- /// </summary>
- public ComputeTaskTimeoutException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskTimeoutException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeTaskTimeoutException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskTimeoutException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeTaskTimeoutException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskTimeoutException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeTaskTimeoutException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeUserUndeclaredException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeUserUndeclaredException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeUserUndeclaredException.cs
deleted file mode 100644
index e3c090e..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeUserUndeclaredException.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// This exception is thrown when user's code throws undeclared runtime exception. By user core it is
- /// assumed the code in Ignite task, Ignite job or SPI. In most cases it should be an indication of unrecoverable
- /// error condition such as assertion, out of memory error, etc.
- /// </summary>
- [Serializable]
- public class ComputeUserUndeclaredException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeUserUndeclaredException"/> class.
- /// </summary>
- public ComputeUserUndeclaredException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeUserUndeclaredException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeUserUndeclaredException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeUserUndeclaredException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeUserUndeclaredException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeUserUndeclaredException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeUserUndeclaredException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}