/// <exception cref="System.Exception"></exception> public virtual V Call() { if (!cancelled.Get()) { try { metrics.GetActiveConnections().IncrementAndGet(); started = Runtime.CurrentTimeMillis(); try { metrics.GetScheduledConnections().DecrementAndGet(); V result = httpclient.Execute(request, responseHandler, context); ended = Runtime.CurrentTimeMillis(); metrics.GetSuccessfulConnections().Increment(started); if (callback != null) { callback.Completed(result); } return(result); } catch (Exception e) { metrics.GetFailedConnections().Increment(started); ended = Runtime.CurrentTimeMillis(); if (callback != null) { callback.Failed(e); } throw; } } finally { metrics.GetRequests().Increment(started); metrics.GetTasks().Increment(started); metrics.GetActiveConnections().DecrementAndGet(); } } else { throw new InvalidOperationException("call has been cancelled for request " + request .GetURI()); } }