public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager); if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd parsed"); } catch (Exception exc) { _removeResult = OperationResult.Failure; if (!base.immatureId.Equals("-2")) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } return; } NCache nCache = clientManager.CmdExecuter as NCache; try { CallbackEntry cbEntry = null; CompressedValueEntry flagValueEntry = null; OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); flagValueEntry = nCache.Cache.Remove(cmdInfo.Key, cmdInfo.FlagMap, cbEntry, cmdInfo.LockId, cmdInfo.LockAccessType, operationContext); UserBinaryObject ubObject = (flagValueEntry == null) ? null : (UserBinaryObject) flagValueEntry.Value; //PROTOBUF:RESPONSE Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); Alachisoft.NCache.Common.Protobuf.RemoveResponse removeResponse = new Alachisoft.NCache.Common.Protobuf.RemoveResponse(); response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.REMOVE; response.remove = removeResponse; response.requestId = Convert.ToInt64(cmdInfo.RequestId); if (ubObject != null) { removeResponse.value.AddRange(ubObject.DataList); removeResponse.flag = flagValueEntry.Flag.Data; } _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _removeResult = OperationResult.Failure; //PROTOBUF:RESPONSE _serializedResponsePackets.Add( Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } finally { if (ServerMonitor.MonitorActivity) ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd executed on cache"); } }
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager); if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd parsed"); } } catch (Exception exc) { _removeResult = OperationResult.Failure; if (!base.immatureId.Equals("-2")) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } return; } NCache nCache = clientManager.CmdExecuter as NCache; try { CallbackEntry cbEntry = null; CompressedValueEntry flagValueEntry = null; OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); flagValueEntry = nCache.Cache.Remove(cmdInfo.Key, cmdInfo.FlagMap, cbEntry, cmdInfo.LockId, cmdInfo.LockAccessType, operationContext); UserBinaryObject ubObject = (flagValueEntry == null) ? null : (UserBinaryObject)flagValueEntry.Value; //PROTOBUF:RESPONSE Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); Alachisoft.NCache.Common.Protobuf.RemoveResponse removeResponse = new Alachisoft.NCache.Common.Protobuf.RemoveResponse(); response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.REMOVE; response.remove = removeResponse; response.requestId = Convert.ToInt64(cmdInfo.RequestId); if (ubObject != null) { removeResponse.value.AddRange(ubObject.DataList); removeResponse.flag = flagValueEntry.Flag.Data; } _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _removeResult = OperationResult.Failure; //PROTOBUF:RESPONSE _serializedResponsePackets.Add( Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } finally { if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd executed on cache"); } } }
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { int overload; string exception = null; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); try { overload = command.MethodOverload; cmdInfo = ParseCommand(command, clientManager); if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd parsed"); } } catch (Exception exc) { _removeResult = OperationResult.Failure; if (!base.immatureId.Equals("-2")) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } return; } NCache nCache = clientManager.CmdExecuter as NCache; if (!cmdInfo.DoAsync) { try { CallbackEntry cbEntry = null; if (cmdInfo.DsItemRemovedId != -1) { cbEntry = new CallbackEntry(clientManager.ClientID, -1, null, -1, -1, -1, cmdInfo.DsItemRemovedId, cmdInfo.FlagMap , Runtime.Events.EventDataFilter.None, Runtime.Events.EventDataFilter.None); //DataFilter not required } CompressedValueEntry flagValueEntry = null; OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ClientId, clientManager.ClientID); operationContext.Add(OperationContextFieldName.MethodOverload, overload); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); flagValueEntry = nCache.Cache.Remove(cmdInfo.Key, cmdInfo.FlagMap, cbEntry, cmdInfo.LockId, cmdInfo.Version, cmdInfo.LockAccessType, cmdInfo.ProviderName, operationContext); stopWatch.Stop(); UserBinaryObject ubObject = null; if (flagValueEntry != null) { if (flagValueEntry.Value is UserBinaryObject) { ubObject = (UserBinaryObject)flagValueEntry.Value; } else { ubObject = (flagValueEntry == null) ? null : (UserBinaryObject)nCache.Cache.SocketServerDataService.GetClientData(flagValueEntry.Value, ref flagValueEntry.Flag, LanguageContext.DOTNET); } } //PROTOBUF:RESPONSE Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); Alachisoft.NCache.Common.Protobuf.RemoveResponse removeResponse = new Alachisoft.NCache.Common.Protobuf.RemoveResponse(); response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.REMOVE; response.remove = removeResponse; response.commandID = command.commandID; response.requestId = Convert.ToInt64(cmdInfo.RequestId); if (ubObject != null) { removeResponse.value.AddRange(ubObject.DataList); removeResponse.flag = flagValueEntry.Flag.Data; } _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _removeResult = OperationResult.Failure; exception = exc.ToString(); //PROTOBUF:RESPONSE _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.REMOVE.ToLower()); log.GenerateRemoveAPILogItem(cmdInfo.Key, cmdInfo.FlagMap, cmdInfo.LockId, (long)cmdInfo.Version, cmdInfo.LockAccessType, cmdInfo.ProviderName, cmdInfo.DsItemRemovedId, overload, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd executed on cache"); } } } else { try { object[] package = null; if (!cmdInfo.RequestId.Equals("-1") || cmdInfo.DsItemRemovedId != -1) { package = new object[] { cmdInfo.Key, cmdInfo.FlagMap, new CallbackEntry(clientManager.ClientID, Convert.ToInt32(cmdInfo.RequestId), null, -1, -1, (short)(cmdInfo.RequestId.Equals("-1") ? -1 : 0), cmdInfo.DsItemRemovedId, cmdInfo.FlagMap , Runtime.Events.EventDataFilter.None, Runtime.Events.EventDataFilter.None), cmdInfo.ProviderName }; // DataFilter not required } else { package = new object[] { cmdInfo.Key, cmdInfo.FlagMap, null, cmdInfo.ProviderName }; } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); operationContext.Add(OperationContextFieldName.MethodOverload, overload); nCache.Cache.RemoveAsync(package, operationContext); stopWatch.Stop(); } 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.RemoveAsync.ToLower()); log.GenerateRemoveAPILogItem(cmdInfo.Key, cmdInfo.FlagMap, cmdInfo.LockId, (long)cmdInfo.Version, cmdInfo.LockAccessType, cmdInfo.ProviderName, cmdInfo.DsItemRemovedId, overload, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("RemCmd.Exec", "cmd executed on cache"); } } } }