public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager); if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("BulkGetCmd.Exec", "cmd parsed"); } } catch (Exception exc) { _getBulkResult = OperationResult.Failure; if (!base.immatureId.Equals("-2")) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } return; } byte[] data = null; NCache nCache = clientManager.CmdExecuter as NCache; try { OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ClientLastViewId, cmdInfo.ClientLastViewId); if (!string.IsNullOrEmpty(cmdInfo.IntendedRecipient)) { operationContext.Add(OperationContextFieldName.IntendedRecipient, cmdInfo.IntendedRecipient); } Hashtable getResult = (Hashtable)nCache.Cache.GetBulk(cmdInfo.Keys, cmdInfo.FlagMap, operationContext); BulkGetResponseBuilder.BuildResponse(getResult, cmdInfo.CommandVersion, cmdInfo.RequestId, _serializedResponsePackets, cmdInfo.IntendedRecipient); } catch (Exception exc) { _getBulkResult = OperationResult.Failure; //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("BulkGetCmd.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(); int count = 0; stopWatch.Start(); try { try { overload = command.MethodOverload; cmdInfo = ParseCommand(command, clientManager); if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("BulkGetCmd.Exec", "cmd parsed"); } } catch (Exception exc) { _getBulkResult = OperationResult.Failure; if (!base.immatureId.Equals("-2")) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } return; } byte[] data = null; NCache nCache = clientManager.CmdExecuter as NCache; HashVector getResult = null; try { OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ClientLastViewId, cmdInfo.ClientLastViewId); if (!string.IsNullOrEmpty(cmdInfo.IntendedRecipient)) { operationContext.Add(OperationContextFieldName.IntendedRecipient, cmdInfo.IntendedRecipient); } operationContext.Add(OperationContextFieldName.ClientOperationTimeout, clientManager.RequestTimeout); operationContext.CancellationToken = CancellationToken; getResult = (HashVector)nCache.Cache.GetBulk(cmdInfo.Keys, cmdInfo.FlagMap, operationContext); stopWatch.Stop(); count = getResult.Count; BulkGetResponseBuilder.BuildResponse(getResult, cmdInfo.CommandVersion, cmdInfo.RequestId, _serializedResponsePackets, cmdInfo.IntendedRecipient, command.commandID, clientManager, nCache.Cache); } catch (OperationCanceledException ex) { exception = ex.ToString(); Dispose(); } catch (Exception exc) { _getBulkResult = OperationResult.Failure; exception = exc.ToString(); //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } finally { TimeSpan executionTime = stopWatch.Elapsed; if (getResult != null) { foreach (CompressedValueEntry compressedValueEntry in getResult.Values) { MiscUtil.ReturnEntryToPool(compressedValueEntry.Entry, clientManager.CacheTransactionalPool); MiscUtil.ReturnCompressedEntryToPool(compressedValueEntry, clientManager.CacheTransactionalPool); } } try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.GetBulk.ToLower()); log.GenerateBulkGetAPILogItem(cmdInfo.Keys.Length, cmdInfo.providerName, overload, exception, executionTime, clientManager.ClientID, clientManager.ClientSocketId.ToString(), count); } } catch { } } } finally { cmdInfo.FlagMap.MarkFree(NCModulesConstants.SocketServer); } if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("BulkGetCmd.Exec", "cmd executed on cache"); } }