private void HandleResult(ThrottlingRpcResult rpcResult, long requestStartTime, long requestCompletionTime, ThrottlingRpcClient client) { long msecInterval = ThrottlingRpcClientImpl.GetMsecInterval(requestStartTime, requestCompletionTime); if (rpcResult != ThrottlingRpcResult.Failed && msecInterval <= 5000L) { this.HandleSuccessfulResponse(); } else if (rpcResult != ThrottlingRpcResult.Failed) { ThrottlingRpcClientImpl.tracer.TraceError <string, long>(0L, "RPC request to mailbox server {0} took {1} milliseconds and treated as failed", this.serverName, msecInterval); ThrottlingRpcClientImpl.EventLogger.LogEvent(ThrottlingClientEventLogConstants.Tuple_RpcRequestTimedout, this.serverName, new object[] { this.serverName, msecInterval }); this.HandleFailure(requestCompletionTime, null); } else { this.HandleFailure(requestCompletionTime, client); } ThrottlingRpcClientImpl.Unref(client); this.perfCounters.AddRequestStatus(rpcResult, msecInterval); }
private void HandleFailure(long failureTime, ThrottlingRpcClient client) { lock (this.syncRoot) { this.failureCount++; this.lastFailureTime = failureTime; if (client != null && this.rpcClient == client) { ThrottlingRpcClientImpl.Unref(this.rpcClient); this.rpcClient = null; } } }
public void Dispose() { lock (this.syncRoot) { this.disposed = true; if (this.rpcClient != null) { if (!ThrottlingRpcClientImpl.Unref(this.rpcClient)) { throw new InvalidOperationException(string.Format("Detected extra reference(s) to RPC client instance for server {0}", this.serverName)); } this.rpcClient = null; } } }