Ejemplo n.º 1
0
        protected virtual object ExecuteOnKeyInternal(IData keyData, IEntryProcessor entryProcessor)
        {
            var request          = MapExecuteOnKeyCodec.EncodeRequest(Name, ToData(entryProcessor), keyData, GetThreadId());
            var response         = Invoke(request, keyData);
            var resultParameters = MapExecuteOnKeyCodec.DecodeResponse(response);

            return(ToObject <object>(resultParameters.Response));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Processes an entry.
        /// </summary>
        /// <param name="keyData">The key.</param>
        /// <param name="processorData">An entry processor.</param>
        /// <param name="cancellationToken">A cancellation token.</param>
        /// <returns>The result of the process.</returns>
        /// <remarks>
        /// <para>The <paramref name="processorData"/> must have a counterpart on the server.</para>
        /// </remarks>
        protected virtual async Task <TResult> ExecuteAsync <TResult>(IData processorData, IData keyData, CancellationToken cancellationToken)
        {
            var requestMessage  = MapExecuteOnKeyCodec.EncodeRequest(Name, processorData, keyData, ContextId);
            var responseMessage = await Cluster.Messaging.SendToKeyPartitionOwnerAsync(requestMessage, keyData, cancellationToken).CfAwait();

            var response = MapExecuteOnKeyCodec.DecodeResponse(responseMessage).Response;

            return(ToObject <TResult>(response));
        }
Ejemplo n.º 3
0
        public object ExecuteOnKey(TKey key, IEntryProcessor entryProcessor)
        {
            ThrowExceptionIfNull(key);
            var keyData = ToData(key);

            InvalidateNearCacheEntry(keyData);
            var request = MapExecuteOnKeyCodec.EncodeRequest(GetName(), ToData(entryProcessor), keyData,
                                                             ThreadUtil.GetThreadId());
            var response         = Invoke(request, keyData);
            var resultParameters = MapExecuteOnKeyCodec.DecodeResponse(response);

            return(ToObject <object>(resultParameters.response));
        }