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

Runs a call that may block for ever (a read on a provider's pipe) on its OWN daemon thread and waits for it a bounded time. More...

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

Classes

interface  Work
 The work. More...
 

Public Member Functions

 AbandonableCall (int maxAbandoned, String threadName)
 
int abandonedAliveCount ()
 

Detailed Description

Runs a call that may block for ever (a read on a provider's pipe) on its OWN daemon thread and waits for it a bounded time.

Plain Java.

  • When the time is up the caller gets control back at once and onAbandon runs on the CALLER's thread: that is where the blocked resource is closed from another thread (closing a file descriptor wakes a blocked libcore read with an exception).
  • A worker that stays stuck anyway is abandoned, not waited for: it is counted, and beyond maxAbandoned stuck workers a new call is refused instead of starting yet another thread. A worker that wakes up later finds out (abandoned is passed to the work), and a result it still produces goes to disposeLate, never to anybody else.
  • Unlike BoundedCall there is no shared pool: an abandoned worker does not take a place away from the next call.

Constructor & Destructor Documentation

◆ AbandonableCall()

de.yaacc.share.AbandonableCall.AbandonableCall ( int maxAbandoned,
String threadName )
Parameters
maxAbandonedhow many abandoned workers may be alive at the same time, at least 1
threadNamethe name of the worker threads

Member Function Documentation

◆ abandonedAliveCount()

int de.yaacc.share.AbandonableCall.abandonedAliveCount ( )
Returns
abandoned workers that are still alive (for tests and diagnostics)

Referenced by de.yaacc.share.WatchedCopy.stuckWorkers().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: