|
YAACC - UPNP Client and Server
|
Decides whether and how a failed Browse request is repeated, so a short network drop does not show up as an empty folder. More...

Classes | |
| interface | Sleeper |
| Sleeps; replaceable so tests do not wait. More... | |
Public Member Functions | |
| ContentDirectoryBrowseResult | execute (Supplier< ContentDirectoryBrowseResult > attempt, BooleanSupplier cancelled) |
Runs attempt until it gives a result that is not retriable, the tries are used up, cancelled turns true or the thread is interrupted while waiting. | |
Static Public Member Functions | |
| static boolean | isRetriable (ContentDirectoryBrowseResult result) |
| static boolean | isFailure (ContentDirectoryBrowseResult result) |
| static long | backoffMillisBefore (int attemptNumber) |
Static Public Attributes | |
| static final int | MAX_ATTEMPTS = 3 |
| Total number of tries, the first one included. | |
| static final long[] | BACKOFF_MILLIS = {500L, 1500L} |
| Wait before try 2 and before try 3. | |
Decides whether and how a failed Browse request is repeated, so a short network drop does not show up as an empty folder.
No Android classes: unit-testable on the JVM.
Rules:
MAX_ATTEMPTS tries in total; the waits before try 2 and 3 are BACKOFF_MILLIS (500 ms, 1500 ms). Meant for the worker thread only: execute sleeps.
|
static |
| attemptNumber | 2 or 3 (the try that follows the wait) |
Referenced by de.yaacc.browser.BrowseRetryPolicy.execute().

| ContentDirectoryBrowseResult de.yaacc.browser.BrowseRetryPolicy.execute | ( | Supplier< ContentDirectoryBrowseResult > | attempt, |
| BooleanSupplier | cancelled ) |
Runs attempt until it gives a result that is not retriable, the tries are used up, cancelled turns true or the thread is interrupted while waiting.

|
static |
result is a failed load: no result at all or a result with a failure (retriable or not); a result without content and without failure is not 
|
static |
result is no answer of the server, so another try can help Referenced by de.yaacc.browser.BrowseRetryPolicy.execute().

