YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.upnp.ReceiverAvailabilityPolicy Class Reference

How long a play action waits for a receiver the user selected that is not in the registry right now. More...

Collaboration diagram for de.yaacc.upnp.ReceiverAvailabilityPolicy:
Collaboration graph

Classes

interface  Sleeper
 Sleeps; replaceable so tests do not wait. More...
 

Public Member Functions

int await (IntSupplier missingCount, IntConsumer beforeWaiting)
 Looks until no selected receiver is missing, the looks are used up or the thread is interrupted while waiting.
 

Static Public Attributes

static final int MAX_ATTEMPTS = 3
 Total number of looks into the registry, the first one included.
 
static final long WAIT_MILLIS = 2500L
 Wait before look 2 and before look 3.
 

Detailed Description

How long a play action waits for a receiver the user selected that is not in the registry right now.

After a suspend the registry may have dropped the renderer (no ssdp:alive could be received) and it is back a moment after a new search, so giving up at once would refuse the play and, worse, drop the receiver from the stored selection.

At most MAX_ATTEMPTS looks in total, WAIT_MILLIS apart (about 5 s), with a chance to start a search before each wait. No Android classes: unit-testable on the JVM. Meant for a worker thread only: await sleeps.

Member Function Documentation

◆ await()

int de.yaacc.upnp.ReceiverAvailabilityPolicy.await ( IntSupplier missingCount,
IntConsumer beforeWaiting )

Looks until no selected receiver is missing, the looks are used up or the thread is interrupted while waiting.

Parameters
missingCounthow many selected receivers are not in the registry now
beforeWaitingcalled with the number of the look that found receivers missing, right before the wait (start a search here); not called after the last look
Returns
the number of receivers still missing after the last look; 0 means all are there

Referenced by de.yaacc.upnp.UpnpClient.awaitReceiverDevices().

Here is the caller graph for this function:

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