Example #1
0
        //PROTOBUF
        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            int    overload;
            string exception = null;

            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
            stopWatch.Start();
            try
            {
                if (clientManager != null)
                {
                    clientManager._leftGracefully = true;
                    NCache nCache = clientManager.CmdExecuter as NCache;
                    if (nCache != null)
                    {
                        nCache.Dispose();
                    }
                    stopWatch.Stop();



                    Alachisoft.NCache.Common.Protobuf.DisposeResponse disposeResponse = new Alachisoft.NCache.Common.Protobuf.DisposeResponse();
                    if (clientManager.ClientVersion >= 5000)
                    {
                        Common.Util.ResponseHelper.SetResponse(disposeResponse, command.requestID, command.commandID);
                        _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeResponse(disposeResponse, Common.Protobuf.Response.Type.DISPOSE));
                    }
                    else
                    {
                        //PROTOBUF:RESPONSE
                        Common.Protobuf.Response response = new Common.Protobuf.Response();
                        response.disposeResponse = disposeResponse;
                        Common.Util.ResponseHelper.SetResponse(response, command.requestID, command.commandID, Common.Protobuf.Response.Type.DISPOSE);
                        _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
                    }
                }
            }
            catch (Exception ex)
            {
                exception = ex.ToString();
            }
            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.Dispose.ToLower());
                        log.GenerateDisposeAPILogItem(1, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString());

                        // Hashtable expirationHint = log.GetDependencyExpirationAndQueryInfo(cmdInfo.ExpirationHint, cmdInfo.queryInfo);
                    }
                }
                catch
                {
                }
            }
        }
Example #2
0
        //PROTOBUF
        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            int    overload;
            string exception = null;

            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
            stopWatch.Start();
            try
            {
                if (clientManager != null)
                {
                    clientManager._leftGracefully = true;
                    NCache nCache = clientManager.CmdExecuter as NCache;
                    if (nCache != null)
                    {
                        nCache.Dispose();
                    }
                    stopWatch.Stop();
                    Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                    response.requestId       = command.requestID;
                    response.commandID       = command.commandID;
                    response.disposeResponse = new Alachisoft.NCache.Common.Protobuf.DisposeResponse();

                    response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.DISPOSE;
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
                }
            }
            catch (Exception ex)
            {
                exception = ex.ToString();
            }
            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.Dispose.ToLower());
                        log.GenerateDisposeAPILogItem(1, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString());
                    }
                }
                catch
                {
                }
            }
        }