コード例 #1
0
 private void ExecuteCommandInPool([NotNull] IThriftConnection connectionInPool, [NotNull] TCommand command, [NotNull] ICommandMetrics metrics)
 {
     try
     {
         using (metrics.NewThriftQueryContext())
             connectionInPool.ExecuteCommand(command);
     }
     catch (Exception e)
     {
         var exception = CassandraExceptionTransformer.Transform(e, $"Failed to execute cassandra command {command.Name} in pool {connectionInPool}");
         if (exception.ReduceReplicaLive)
         {
             connectionPool.Bad(connectionInPool);
         }
         else
         {
             connectionPool.Good(connectionInPool);
         }
         if (exception.IsCorruptConnection)
         {
             connectionPool.Remove(connectionInPool);
         }
         else
         {
             connectionPool.Release(connectionInPool);
         }
         throw exception;
     }
 }