Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Commit

Permalink
Add Javadocs links to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rnorth committed Aug 30, 2015
1 parent bcc43b3 commit 1ced37a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
9 changes: 7 additions & 2 deletions docs/circuitbreaker.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ be called on subsequent invocations as long as the breaker remains in the `OK` s
If **1** throws an exception, **2** and **3** will be called immediately, and the breaker will change into
the `BROKEN` state. Thereafter, every time this code is hit **3** will be called.

## Key Javadocs

* **[BreakerBuilder](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/circuitbreakers/BreakerBuilder.html)**
* **[Breaker](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/circuitbreakers/Breaker.html)**

## Features/TODOs

* Support for calling a void-return `Runnable`, or getting a value from a `Callable` (see `tryDo` and `tryGet` methods)
* Optional automatic reset a given time after the last failure
* Optional holding of state in an external object or Map (aimed at allowing breaker state to be shared across a cluster)
* Optional automatic reset a given time after the last failure ([javadocs](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/circuitbreakers/BreakerBuilder.html#autoResetAfter-long-java.util.concurrent.TimeUnit-))
* Optional holding of state in an external object or Map (aimed at allowing breaker state to be shared across a cluster - [javadocs](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/circuitbreakers/BreakerBuilder.html#storeStateIn-java.util.concurrent.ConcurrentMap-java.lang.String-))
* TODO: Configurable trip after _n_ consecutive failures
* TODO: Configurable trip at _x_% failure rate
* TODO: Configurable logging of breaker state transitions
Expand Down
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ features, it was renamed.
* **[Timeout functions](timeout.md):** quick and easy wrappers for code to automatically limit execution time
* **[Rate limiter](ratelimiter.md) implementation:** limit how often a block of code can be called

## Javadocs

See [here](http://rnorth.github.io/duct-tape/index.html)

## Example

This example combines several of the above features:
Expand Down
7 changes: 6 additions & 1 deletion docs/ratelimiter.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ Limit calls to a third party service to a maximum of 2 per second.
// Somewhere else (the call site), wrap the call to the third party service in the rate limiter
result = sharedRateLimiter.getWhenReady(() -> {
return externalApi.fetchSomethingById(id)
});
});

## Key Javadocs

* **[RateLimiterBuilder](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/ratelimits/RateLimiterBuilder.html)**
* **[RateLimiter](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/ratelimits/RateLimiter.html)**
21 changes: 14 additions & 7 deletions docs/retry.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ a polling approach. These retry functions try to reduce the amount of boilerplat

## Calling *unreliable* code

The `Unreliables` class caters for calls that may be unreliable:
* `retryUntilSuccess` retries a call that might throw exceptions. The call will be repeated (up to a time limit)
The [Unreliables](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/unreliables/Unreliables.html) class caters for
calls that may be unreliable:
* [retryUntilSuccess](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/unreliables/Unreliables.html#retryUntilSuccess-int-java.util.concurrent.TimeUnit-java.util.concurrent.Callable-) retries a call that might throw exceptions. The call will be repeated (up to a time limit)
until it returns a result.
* `retryUntilTrue` retries a call until it returns `true`
* [retryUntilTrue](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/unreliables/Unreliables.html#retryUntilTrue-int-java.util.concurrent.TimeUnit-java.util.concurrent.Callable-) retries a call until it returns `true`

## Calling *inconsistent* code

The `Inconsistents` class deals with calls that might return a result quickly, but that take some time to stabilize
on a consistent result. A call wrapped with `retryUntilConsistent` will be called until the result is stable (equal) for
a minimum period of time, or until a time limit is hit.
The [Inconsistents](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/inconsistents/Inconsistents.html)
class deals with calls that might return a result quickly, but that take some time to stabilize
on a consistent result. A call wrapped with [retryUntilConsistent](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/inconsistents/Inconsistents.html#retryUntilConsistent-int-int-java.util.concurrent.TimeUnit-java.util.concurrent.Callable-)
will be called until the result is stable (equal) for a minimum period of time, or until a time limit is hit.

## A note about retry frequency

Expand All @@ -48,4 +50,9 @@ Wait until a collection of UI elements has been fully updated by JavaScript code

List<WebElement> listItems = Inconsistents.retryUntilConsistent(300, 1000, TimeUnit.MILLISECONDS, () -> {
return driver.findElements(By.cssSelector("li.product"));
});
});

## Key Javadocs

* **[Unreliables](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/unreliables/Unreliables.html)**
* **[Inconsistents](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/inconsistents/Inconsistents.html)**
11 changes: 8 additions & 3 deletions docs/timeout.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
The timeout functions provide a very simple way to ensure that a given block of code does not exceed a given execution
time.

The `Timeouts` class allows dispatching a synchronous call that does not return a result (`doWithTimeout`) or a
synchronous call that returns a result (`getWithTimeout`).
The [Timeouts](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/timeouts/Timeouts.html)
class allows dispatching a synchronous call that does not return a result ([doWithTimeout](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/timeouts/Timeouts.html#doWithTimeout-int-java.util.concurrent.TimeUnit-java.lang.Runnable-))
or a synchronous call that returns a result ([getWithTimeout](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/timeouts/Timeouts.html#getWithTimeout-int-java.util.concurrent.TimeUnit-java.util.concurrent.Callable-)).

## Examples

Expand All @@ -22,4 +23,8 @@ Try to invoke an external service without returning a result, but time out if it

Timeouts.doWithTimeout(30, TimeUnit.SECONDS, () -> {
myExternalService.doSomething();
});
});

## Key Javadocs

* **[Timeouts](http://rnorth.github.io/duct-tape/org/rnorth/ducttape/timeouts/Timeouts.html)**

0 comments on commit 1ced37a

Please sign in to comment.