Exemple #1
0
        //PROTOBUF

        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"))
                {
                    //_resultPacket = clientManager.ReplyPacket(base.ExceptionPacket(exc, base.immatureId), base.ParsingExceptionMessage(exc));
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion));
                }
                return;
            }

            try
            {
                string typeInfoMap = "";
                NCache nCache      = clientManager.CmdExecuter as NCache;

                if (nCache.Cache.GetTypeInfoMap() != null)
                {
                    typeInfoMap = nCache.Cache.GetTypeInfoMap().ToProtocolString();
                }

                Alachisoft.NCache.Common.Protobuf.Response           response           = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.GetTypeMapResponse getTypeMapResponse = new Alachisoft.NCache.Common.Protobuf.GetTypeMapResponse();
                getTypeMapResponse.map = typeInfoMap;
                response.getTypemap    = getTypeMapResponse;
                response.requestId     = Convert.ToInt64(cmdInfo.RequestId);

                response.commandID    = command.commandID;
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_TYPEINFO_MAP;

                if (clientManager.ClientVersion >= 5000)
                {
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response, Common.Protobuf.Response.Type.GET_TYPEINFO_MAP));
                }
                else
                {
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
                }
            }
            catch (Exception exc)
            {
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion));
            }
        }
Exemple #2
0
        //PROTOBUF
        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
            {
                string typeInfoMap = "";
                NCache nCache = clientManager.CmdExecuter as NCache;

                if (nCache.Cache.GetTypeInfoMap() != null)
                    typeInfoMap = nCache.Cache.GetTypeInfoMap().ToProtocolString();

                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.GetTypeMapResponse getTypeMapResponse = new Alachisoft.NCache.Common.Protobuf.GetTypeMapResponse();
                getTypeMapResponse.map = typeInfoMap;
                response.getTypemap = getTypeMapResponse;
                response.requestId = Convert.ToInt64(cmdInfo.RequestId);
                response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_TYPEINFO_MAP;

                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
            }
            catch (Exception exc)
            {
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID));
            }
        }