Runs a call that may block for ever (a content provider of another app) on a small pool of daemon threads and waits for it only a bounded time.
More...
|
| class | Result |
| | The outcome of callDetailed: the value (null on any failure) and whether the call was turned away because there was no room (the provider's gate or the pool was full), as opposed to a provider that did not answer in time or failed.
|
| |
Runs a call that may block for ever (a content provider of another app) on a small pool of daemon threads and waits for it only a bounded time.
Plain Java.
-
At most
maxThreads calls run at once; a call that finds the pool busy is refused at once (returns null). A provider that hangs can therefore tie up at most that many threads, however many intents arrive.
-
The caller waits at most
timeoutMillis. A call that returns after the caller gave up has its result handed to disposeLate (to close a descriptor), never to anybody else.
-
Every failure (timeout, refusal, exception of the call, interrupt) is a null result; the exception is not kept or logged, it may carry the provider's text.
-
With a
ProviderCallGate and a key per provider (call(String, Callable, long,
Consumer)), one provider has at most one call in flight: a call whose provider still has an earlier call outstanding (running, or hung) is dropped at once without taking a thread, so one hostile provider can pin one thread, not the pool.
◆ BoundedCall() [1/2]
| de.yaacc.share.BoundedCall.BoundedCall |
( |
int | maxThreads, |
|
|
String | threadName ) |
- Parameters
-
| maxThreads | the most calls that may run (or hang) at once, at least 1 |
| threadName | the name of the pool's threads |
◆ BoundedCall() [2/2]
| de.yaacc.share.BoundedCall.BoundedCall |
( |
int | maxThreads, |
|
|
String | threadName, |
|
|
ProviderCallGate | gate ) |
- Parameters
-
| maxThreads | the most calls that may run (or hang) at once, at least 1 |
| threadName | the name of the pool's threads |
| gate | the per-provider gate used by call(String, Callable, long, Consumer), may be null (then a key is not checked) |
The documentation for this class was generated from the following file:
- /github/workspace/yaacc/src/main/java/de/yaacc/share/BoundedCall.java