コード例 #1
0
 /// <summary>
 /// Starts a new execution and adds it to the executions collection
 /// </summary>
 private void StartNewExecution()
 {
     try
     {
         var execution = new RequestExecution <T>(this, _session, _request);
         execution.Start();
         _running.Add(execution);
         ScheduleNext();
     }
     catch (NoHostAvailableException ex)
     {
         if (_running.Count == 0)
         {
             //Its the sending of the first execution
             //There isn't any host available, yield it to the user
             SetCompleted(ex);
         }
         //Let's wait for the other executions
     }
     catch (Exception ex)
     {
         //There was an Exception before sending: a protocol error or the keyspace does not exists
         SetCompleted(ex);
     }
 }
コード例 #2
0
 public void SetNoMoreHosts(NoHostAvailableException ex, RequestExecution <T> execution)
 {
     //An execution ended with a NoHostAvailableException (retrying or starting).
     //If there is a running execution, do not yield it to the user
     _running.Remove(execution);
     if (_running.Count > 0)
     {
         Logger.Info("Could not obtain an available host for speculative execution");
         return;
     }
     SetCompleted(ex);
 }