Example #1
0
        /// <summary>
        /// Executes given job on the node where data for provided affinity key is located
        /// (a.k.a. affinity co-location).
        /// </summary>
        /// <param name="cacheName">Name of the cache to use for affinity co-location.</param>
        /// <param name="affinityKey">Affinity key.</param>
        /// <param name="action">Job to execute.</param>
        public Future <object> AffinityRun(string cacheName, object affinityKey, IComputeAction action)
        {
            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
            IgniteArgumentCheck.NotNull(action, "action");

            return(DoAffinityOp <object>(cacheName, null, affinityKey, action, OpAffinityRun));
        }
Example #2
0
        /// <summary>
        /// Broadcasts given job to all nodes in grid projection.
        /// </summary>
        /// <param name="action">Job to broadcast to all projection nodes.</param>
        public IFuture <object> Broadcast(IComputeAction action)
        {
            IgniteArgumentCheck.NotNull(action, "action");

            return(ExecuteClosures0(new ComputeSingleClosureTask <object, object, object>(),
                                    new ComputeActionJob(action), opId: OpBroadcast));
        }
Example #3
0
        /// <summary>
        /// Executes provided job on a node in this grid projection.
        /// </summary>
        /// <param name="action">Job to execute.</param>
        public Future <object> Run(IComputeAction action)
        {
            IgniteArgumentCheck.NotNull(action, "action");

            return(ExecuteClosures0(new ComputeSingleClosureTask <object, object, object>(),
                                    new ComputeActionJob(action)));
        }
Example #4
0
        /** <inheritDoc /> */
        public Task AffinityRunAsync(string cacheName, object affinityKey, IComputeAction action,
                                     CancellationToken cancellationToken)
        {
            IgniteArgumentCheck.NotNull(cacheName, "cacheName");

            return(GetTaskIfAlreadyCancelled <object>(cancellationToken) ??
                   _compute.AffinityRun(cacheName, affinityKey, action).GetTask(cancellationToken));
        }
Example #5
0
        /// <summary>
        /// Executes given job on the node where data for provided affinity key is located
        /// (a.k.a. affinity co-location).
        /// </summary>
        /// <param name="cacheName">Name of the cache to use for affinity co-location.</param>
        /// <param name="affinityKey">Affinity key.</param>
        /// <param name="action">Job to execute.</param>
        public Future <object> AffinityRun(string cacheName, object affinityKey, IComputeAction action)
        {
            IgniteArgumentCheck.NotNull(action, "action");

            return(ExecuteClosures0(new ComputeSingleClosureTask <object, object, object>(),
                                    new ComputeActionJob(action), opId: OpAffinity,
                                    writeAction: w => WriteAffinity(w, cacheName, affinityKey)));
        }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ComputeActionJob"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public ComputeActionJob(IBinaryRawReader reader)
 {
     _action = reader.ReadObject <IComputeAction>();
 }
Example #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="action">Action.</param>
 public ComputeActionJob(IComputeAction action)
 {
     _action = action;
 }
Example #8
0
 /** <inheritDoc /> */
 public void Run(IComputeAction action)
 {
     _curFut.Value = Compute.Run(action);
 }
Example #9
0
        /** <inheritDoc /> */
        public Task AffinityRunAsync(string cacheName, object affinityKey, IComputeAction action)
        {
            IgniteArgumentCheck.NotNull(cacheName, "cacheName");

            return(_compute.AffinityRun(cacheName, affinityKey, action).Task);
        }
Example #10
0
 /** <inheritDoc /> */
 public Task RunAsync(IComputeAction action, CancellationToken cancellationToken)
 {
     return(GetTaskIfAlreadyCancelled <object>(cancellationToken) ??
            _compute.Run(action).GetTask(cancellationToken));
 }
Example #11
0
 /** <inheritDoc /> */
 public void Run(IComputeAction action)
 {
     _compute.Run(action).Get();
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ComputeActionJob"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public ComputeActionJob(IBinaryRawReader reader)
 {
     _action = reader.ReadObject<IComputeAction>();
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="action">Action.</param>
 public ComputeActionJob(IComputeAction action)
 {
     _action = action;
 }
Example #14
0
 /** <inheritDoc /> */
 public void AffinityRun(string cacheName, object affinityKey, IComputeAction action)
 {
     _compute.AffinityRun(cacheName, affinityKey, action).Get();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComputeActionJob"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ComputeActionJob(IBinaryReader reader)
        {
            var reader0 = (BinaryReader)reader.GetRawReader();

            _action = reader0.ReadObject<IComputeAction>();
        }
Example #16
0
 /** <inheritDoc /> */
 public Task AffinityRunAsync(IEnumerable <string> cacheNames, int partition, IComputeAction action,
                              CancellationToken cancellationToken)
 {
     return(_compute.AffinityRun(cacheNames, partition, action).GetTask(cancellationToken));
 }
Example #17
0
 /** <inheritDoc /> */
 public Task AffinityRunAsync(IEnumerable <string> cacheNames, int partition, IComputeAction action)
 {
     return(_compute.AffinityRun(cacheNames, partition, action).Task);
 }
Example #18
0
 /** <inheritDoc /> */
 public void AffinityRun(IEnumerable <string> cacheNames, int partition, IComputeAction action)
 {
     _compute.AffinityRun(cacheNames, partition, action).Get();
 }
Example #19
0
 /** <inheritDoc /> */
 public void Broadcast(IComputeAction action)
 {
     _compute.Broadcast(action).Get();
 }
Example #20
0
 /** <inheritDoc /> */
 public Task AffinityRunAsync(string cacheName, object affinityKey, IComputeAction action)
 {
     return(_compute.AffinityRun(cacheName, affinityKey, action).Task);
 }
Example #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ComputeActionJob"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ComputeActionJob(IPortableReader reader)
        {
            var reader0 = (PortableReaderImpl)reader.RawReader();

            _action = PortableUtils.ReadPortableOrSerializable <IComputeAction>(reader0);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComputeActionJob"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ComputeActionJob(IPortableReader reader)
        {
            var reader0 = (PortableReaderImpl)reader.RawReader();

            _action = PortableUtils.ReadPortableOrSerializable<IComputeAction>(reader0);
        }
Example #23
0
 /** <inheritDoc /> */
 public Task AffinityRunAsync(string cacheName, object affinityKey, IComputeAction action,
                              CancellationToken cancellationToken)
 {
     return(GetTaskIfAlreadyCancelled <object>(cancellationToken) ??
            _compute.AffinityRun(cacheName, affinityKey, action).GetTask(cancellationToken));
 }
Example #24
0
 /** <inheritDoc /> */
 public Task BroadcastAsync(IComputeAction action)
 {
     return(_compute.Broadcast(action).Task);
 }
Example #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ComputeActionJob"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public ComputeActionJob(IBinaryRawReader reader)
 {
     _action = (IComputeAction)reader.ReadObject <object>();
 }
Example #26
0
 /** <inheritDoc /> */
 public Task RunAsync(IComputeAction action)
 {
     return(_compute.Run(action).Task);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComputeActionJob"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ComputeActionJob(IBinaryReader reader)
        {
            var reader0 = (BinaryReader)reader.GetRawReader();

            _action = reader0.ReadObject <IComputeAction>();
        }
Example #28
0
        /** <inheritDoc /> */
        public void AffinityRun(string cacheName, object affinityKey, IComputeAction action)
        {
            IgniteArgumentCheck.NotNull(cacheName, "cacheName");

            _compute.AffinityRun(cacheName, affinityKey, action).Get();
        }
Example #29
0
 /** <inheritDoc /> */
 public Task BroadcastAsync(IComputeAction action, CancellationToken cancellationToken)
 {
     return GetTaskIfAlreadyCancelled<object>(cancellationToken) ??
         _compute.Broadcast(action).GetTask(cancellationToken);
 }
Example #30
0
 /// <summary>
 /// Executes given func on a node where specified partition is located.
 /// </summary>
 /// <param name="cacheNames">Cache names. First cache is used for co-location.</param>
 /// <param name="partition">Partition.</param>
 /// <param name="func">Func to execute.</param>
 /// <returns>Result.</returns>
 public Future <object> AffinityRun(IEnumerable <string> cacheNames, int partition, IComputeAction func)
 {
     return(DoAffinityOp <object>(cacheNames, partition, null, func, OpAffinityRunPartition));
 }
Example #31
0
 /** <inheritDoc /> */
 public void Broadcast(IComputeAction action)
 {
     _curFut.Value = Compute.Broadcast(action);
 }