Esempio n. 1
0
        protected override void CreateCommand()
        {
            try
            {
                base._command = new Common.Protobuf.Command();

                Common.Protobuf.TaskCancelCommand taskCancelCommand = new Common.Protobuf.TaskCancelCommand();
                taskCancelCommand.taskId    = this._taskId;
                taskCancelCommand.cancelAll = this._cancelAll;

                base._command.requestID         = this.RequestId;
                base._command.TaskCancelCommand = taskCancelCommand;
                base._command.type = Common.Protobuf.Command.Type.CANCEL_TASK;
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 2
0
        public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command)
        {
            string taskId = null;
            long   requestId;

            try
            {
                Common.Protobuf.TaskCancelCommand comm = command.TaskCancelCommand;

                if (comm.taskId != null || !string.IsNullOrEmpty(comm.taskId))
                {
                    taskId = comm.taskId;
                }

                requestId = command.requestID;
            }
            catch (Exception ex)
            {
                if (base.immatureId != "-2")
                {
                    _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(ex, command.requestID, command.commandID));
                }
                return;
            }

            try
            {
                ICommandExecuter tmpVar = clientManager.CmdExecuter;
                NCache           nCache = (NCache)((tmpVar is NCache) ? tmpVar : null);

                nCache.Cache.CancelTask(taskId);
                Common.Protobuf.Response reponse = new Common.Protobuf.Response();
                reponse.requestId            = requestId;
                reponse.commandID            = command.commandID;
                reponse.TaskCallbackResponse = new Common.Protobuf.TaskCallbackResponse();
                _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(reponse));
            }
            catch (Exception ex)
            {
                _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(ex, command.requestID, command.commandID));
            }
        }