/** * Specifies the number of tolerated failures within the * configured time window. If limit is set to <em>n</em> then the * <em>(n+1)</em>th failure will trip the breaker. Mutating the * limit at runtime can reset previous failure counts. * @param limit <code>int</code> */ public void setLimit(int limit) { this.limit=limit; initCounter(); }
/** * Specifies the length of the tolerance window in milliseconds. * @param windowMillis <code>long</code> */ public void setWindowMillis(long windowMillis) { this.windowMillis=windowMillis; initCounter(); } }
/** * Constructor that allows a tolerance for a certain number of * failures within a given window of time without tripping. * @param limit the number of failures that will be tolerated * (i.e. the number of failures has to be strictly <em>greater * than</em> this number in order to trip the breaker). For * example, if the limit is 3, the fourth failure during * the window will cause the breaker to trip. * @param windowMillis length of the window in milliseconds */ public DefaultFailureInterpreter(int limit, long windowMillis) { setIgnore(defaultIgnore); setLimit(limit); setWindowMillis(windowMillis); initCounter(); }
/** * Constructor where we specify tolerance and a set of ignored failures. * * @param ignore an array of {@link Throwable} classes that will * be ignored. Any given <code>Throwable</code> that is a * subclass of one of these classes will be ignored. * @param limit the number of failures that will be tolerated * (i.e. the number of failures has to be strictly <em>greater * than</em> this number in order to trip the breaker). For * example, if the limit is 3, the fourth failure during * the window will cause the breaker to trip. * @param windowMillis length of the window in milliseconds */ public DefaultFailureInterpreter(Class<? extends Throwable>[] ignore, int limit, long windowMillis) { setIgnore(ignore); setLimit(limit); setWindowMillis(windowMillis); initCounter(); }