public override void OverrideConnectionConfig(ConnectionConfig config) { // DO NOTHING }
public object Execute(Delegate executionBlock, string keyspaceName, ConnectionConfig overrideConnectionConfig) { object rtnObject = null; int executionCounter = 0; IClient client = null; bool noException = false; bool isClientHealthy = true; Exception exception = null; bool existsConnectionConfig = overrideConnectionConfig != null; do { LOGGER.Trace(LOGGER.StringFormatInvariantCulture("Execution try #{0} from #{1}.", executionCounter, this.MaximumRetries)); exception = null; noException = false; isClientHealthy = false; client = this.AcquireClient(keyspaceName); if (client != null) { LOGGER.Trace("Client not null."); if (existsConnectionConfig) { LOGGER.Trace("Overriding client connection config."); client.OverrideConnectionConfig(overrideConnectionConfig); } try { LOGGER.Trace("Executing executionBlock."); rtnObject = client.Execute(executionBlock); noException = true; isClientHealthy = true; } catch (ExecutionBlockException ex) { LOGGER.Error("ExecutionBlockException found.", ex); exception = ex; isClientHealthy = ex.IsClientHealthy; if (!ex.ShouldRetry) { executionCounter = 0; } } finally { if (noException || isClientHealthy) { if (existsConnectionConfig) { LOGGER.Debug("Resetting client connection parameters to its defaults."); client.ResetToDefaultConnectionConfig(); } LOGGER.Debug("Releasing client back to pool."); this.Release(client, false); } else { LOGGER.Debug("Invalidating client."); this.Invalidate(client, false); } } } else { throw new AquilesException("No client could be borrowed."); } executionCounter++; } while (executionCounter < this.MaximumRetries && !noException); if (exception != null) { throw exception; } return rtnObject; }
public abstract void OverrideConnectionConfig(ConnectionConfig config);
public object Execute(Delegate executionBlock, ConnectionConfig overrideConnectionConfig) { return this.Execute(executionBlock, null, overrideConnectionConfig); }
public override void OverrideConnectionConfig(ConnectionConfig config) { if (config.ReceiveTimeout != null && config.ReceiveTimeout.HasValue) { this.TcpClient.ReceiveTimeout = config.ReceiveTimeout.Value; } if (config.SendTimeout != null && config.SendTimeout.HasValue) { this.TcpClient.SendTimeout = config.SendTimeout.Value; } }