예제 #1
0
        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo cmdInfo;

            try
            {
                cmdInfo = ParseCommand(command, clientManager);
            }
            catch (Exception exc)
            {
                if (!base.immatureId.Equals("-2"))
                {
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
                }

                return;
            }

            try
            {
                NCache          nCache = clientManager.CmdExecuter as NCache;
                ReaderResultSet reader = nCache.Cache.GetReaderChunk(cmdInfo.ReaderId, cmdInfo.nextIndex, false, cmdInfo.OperationContext);

                ReaderResponseBuilder.BuildReaderChunkResponse(reader, cmdInfo.RequestId, _serializedResponsePackets);
            }
            catch (Exception exc)
            {
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
            }
        }
예제 #2
0
        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo cmdInfo;
            int         overload;
            int         count     = 0;
            string      exception = null;
            Stopwatch   stopWatch = new Stopwatch();

            stopWatch.Start();
            try
            {
                overload = 1;
                cmdInfo  = ParseCommand(command, clientManager);
            }
            catch (Exception exc)
            {
                if (!base.immatureId.Equals("-2"))
                {
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID));
                }

                return;
            }

            try
            {
                NCache          nCache = clientManager.CmdExecuter as NCache;
                ReaderResultSet reader = nCache.Cache.GetReaderChunk(cmdInfo.ReaderId, cmdInfo.nextIndex, false, cmdInfo.OperationContext);
                stopWatch.Stop();
                ReaderResponseBuilder.BuildReaderChunkResponse(reader, cmdInfo.RequestId, _serializedResponsePackets, command.commandID, clientManager.ClientVersion < 4620, out count);
            }
            catch (Exception exc)
            {
                exception = exc.ToString();
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID));
            }
            finally
            {
                TimeSpan executionTime = stopWatch.Elapsed;
                try
                {
                    if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging)
                    {
                        APILogItemBuilder log = new APILogItemBuilder(MethodsName.GetReaderChunkCommand.ToLower());
                        log.GenerateGetReaderChunkCommand(cmdInfo.ReaderId, count, overload, exception, executionTime, clientManager.ClientID, clientManager.ClientSocketId.ToString());
                    }
                }
                catch
                {
                }
            }
        }