YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.share.BoundedCall Class Reference

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...

Collaboration diagram for de.yaacc.share.BoundedCall:
Collaboration graph

Classes

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.
 

Public Member Functions

 BoundedCall (int maxThreads, String threadName)
 
 BoundedCall (int maxThreads, String threadName, ProviderCallGate gate)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ BoundedCall() [1/2]

de.yaacc.share.BoundedCall.BoundedCall ( int maxThreads,
String threadName )
Parameters
maxThreadsthe most calls that may run (or hang) at once, at least 1
threadNamethe name of the pool's threads

◆ BoundedCall() [2/2]

de.yaacc.share.BoundedCall.BoundedCall ( int maxThreads,
String threadName,
ProviderCallGate gate )
Parameters
maxThreadsthe most calls that may run (or hang) at once, at least 1
threadNamethe name of the pool's threads
gatethe 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: