private bool RemoveInProgressItem(Guid correlationId, string marker, out WorkItem workItem, out ITaskCompletionWrapper wrapper) { lock (_connectionLock) { if (_inProgress.TryRemove(correlationId, out workItem)) { Interlocked.Decrement(ref _inProgressCount); return(_outstandingOperations.TryRemove(correlationId, out wrapper)); } wrapper = null; return(false); } }
private void Send(WorkItem workItem, ITaskCompletionWrapper wrapper) { lock (_connectionLock) { var correlationId = workItem.TcpPackage.CorrelationId; _inProgress.TryAdd(correlationId, workItem); if (wrapper != null) { _outstandingOperations.TryAdd(correlationId, wrapper); } else { ITaskCompletionWrapper unused; Debug.Assert(_outstandingOperations.TryGetValue(correlationId, out unused), "Initially wrapper should be prsebt in outstanding tasks"); } _connection.EnqueueSend(workItem.TcpPackage.AsByteArray()); } }
internal void RegisterHandler(Guid correlationId, ITaskCompletionWrapper wrapper) { _outstandingOperations.TryAdd(correlationId, wrapper); }
private void Send(WorkItem workItem, ITaskCompletionWrapper wrapper) { lock (_connectionLock) { var correlationId = workItem.TcpPackage.CorrelationId; _inProgress.TryAdd(correlationId, workItem); if (wrapper != null) _outstandingOperations.TryAdd(correlationId, wrapper); else { ITaskCompletionWrapper unused; Debug.Assert(_outstandingOperations.TryGetValue(correlationId, out unused), "Initially wrapper should be prsebt in outstanding tasks"); } _connection.EnqueueSend(workItem.TcpPackage.AsByteArray()); } }
private bool RemoveInProgressItem(Guid correlationId, string marker, out WorkItem workItem, out ITaskCompletionWrapper wrapper) { lock (_connectionLock) { if (_inProgress.TryRemove(correlationId, out workItem)) { Interlocked.Decrement(ref _inProgressCount); return _outstandingOperations.TryRemove(correlationId, out wrapper); } wrapper = null; return false; } }
internal void RegisterHandler(Guid correlationId, ITaskCompletionWrapper wrapper) { _outstandingOperations.TryAdd(correlationId, wrapper); }