public CloseStreamCommand(string key, string lockHandle, int methodOverload) { base.name = "CloseStreamCommand"; _closeStreamCommand = new Alachisoft.NCache.Common.Protobuf.CloseStreamCommand(); _closeStreamCommand.key = key; _closeStreamCommand.lockHandle = lockHandle; _closeStreamCommand.requestId = base.RequestId; _methodOverload = methodOverload; }
public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { Alachisoft.NCache.Common.Protobuf.CloseStreamCommand closeStreamCommand = command.closeStreamCommand; string lockHandle = null; int overload; string exception = null; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); overload = command.MethodOverload; try { if (clientManager != null) { ((NCache)clientManager.CmdExecuter).Cache.CloseStream(closeStreamCommand.key, closeStreamCommand.lockHandle, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); stopWatch.Stop(); } } catch (Exception e) { //PROTOBUF:RESPONSE exception = e.ToString(); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(e, command.requestID, command.commandID)); return; } 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.CloseStream.ToLower()); log.GenerateCloseStreamAPILogItem(closeStreamCommand.key, closeStreamCommand.lockHandle, overload, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } } Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); Alachisoft.NCache.Common.Protobuf.CloseStreamResponse closeStreamResponse = new Alachisoft.NCache.Common.Protobuf.CloseStreamResponse(); response.requestId = closeStreamCommand.requestId; response.commandID = command.commandID; response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.CLOSE_STREAM; response.closeStreamResponse = closeStreamResponse; _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); }