com.twitter.common.thrift
Class Config.AbstractBuilder<T extends Config.AbstractBuilder>

java.lang.Object
  extended by com.twitter.common.thrift.Config.AbstractBuilder<T>
Direct Known Subclasses:
Config.Builder, Thrift.ClientBuilder
Enclosing class:
Config

public abstract static class Config.AbstractBuilder<T extends Config.AbstractBuilder>
extends Object


Method Summary
 T blocking()
          Specifies that all calls be blocking calls with no inherent deadline.
 T disableStats()
          Disables stats collection on the client (enabled by default).
protected  Config getConfig()
           
protected abstract  T getThis()
           
 T noRetries()
          Specifies that no calls be automatically retried.
 T retryOn(Class<? extends Exception> exception)
          Specifies the set of exception classes that are to be considered retryable (if retries are enabled).
 T retryOn(Iterable<? extends Class<? extends Exception>> retryableExceptions)
          Specifies the set of exception classes that are to be considered retryable (if retries are enabled).
 T withConnectTimeout(Amount<Long,Time> timeout)
          Assigns the timeout for all connections established with the blocking client.
 T withDebug(boolean debug)
          When debug == true, specifies that extra debugging information should be logged.
 T withRequestTimeout(Amount<Long,Time> timeout)
          Specifies that all calls be subject to a global timeout.
 T withRetries(int retries)
          Specifies that failing calls meeting retry criteria be retried up to a maximum of retries times before failing.
 T withStatsProvider(StatsProvider statsProvider)
          Registers a custom stats provider to use to track various client stats.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getThis

protected abstract T getThis()

blocking

public final T blocking()
Specifies that all calls be blocking calls with no inherent deadline. It may be the case that underlying transports will eventually deadline, but Thrift will not enforce a dealine.


withRequestTimeout

public final T withRequestTimeout(Amount<Long,Time> timeout)
Specifies that all calls be subject to a global timeout. This deadline includes all call activities, including obtaining a free connection and any automatic retries.


withConnectTimeout

public final T withConnectTimeout(Amount<Long,Time> timeout)
Assigns the timeout for all connections established with the blocking client. On an asynchronous client this timeout is only used for the connection pool lock acquisition on initial calls (not retries, @see withRetries). The actual network connection timeout for the asynchronous client is governed by socketTimeout.

Parameters:
timeout - Connection timeout.
Returns:
A reference to the builder.

noRetries

public final T noRetries()
Specifies that no calls be automatically retried.


withRetries

public final T withRetries(int retries)
Specifies that failing calls meeting retry criteria be retried up to a maximum of retries times before failing. On an asynchronous client, these retries will be forced to be non-blocking, failing fast if they cannot immediately acquire the connection pool locks, so they only provide a best-effort retry strategy there.


retryOn

public final T retryOn(Iterable<? extends Class<? extends Exception>> retryableExceptions)
Specifies the set of exception classes that are to be considered retryable (if retries are enabled). Any exceptions thrown by the underlying thrift call will be considered retryable if they are an instance of any one of the specified exception classes. The set of exception classes must contain at least exception class. To specify no retries either use noRetries() or pass zero to withRetries(int).


retryOn

public final T retryOn(Class<? extends Exception> exception)
Specifies the set of exception classes that are to be considered retryable (if retries are enabled). Any exceptions thrown by the underlying thrift call will be considered retryable if they are an instance of any one of the specified exception classes. The set of exception classes must contain at least exception class. To specify no retries either use noRetries() or pass zero to withRetries(int).


withDebug

public final T withDebug(boolean debug)
When debug == true, specifies that extra debugging information should be logged.


disableStats

public T disableStats()
Disables stats collection on the client (enabled by default).


withStatsProvider

public T withStatsProvider(StatsProvider statsProvider)
Registers a custom stats provider to use to track various client stats.


getConfig

protected final Config getConfig()