YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.util.ExitSequence Class Reference

The steps of the exit of the app in the order they are added (tasks 12.2 and 12.9): the players first (they release their media session and their notification, and a Snapcast player gives the group its stream back), then the services, then the notifications, then the end of the process. More...

Collaboration diagram for de.yaacc.util.ExitSequence:
Collaboration graph

Classes

class  Result
 What happened.
 
interface  Step
 One step; may throw anything. More...
 

Public Member Functions

ExitSequence add (String name, Step step)
 Adds a step at the end.
 
Result run ()
 Runs the steps in order; every one is isolated.
 

Static Public Member Functions

static boolean shouldKeepWaiting (boolean somethingStillRunning, long waitedMillis, long minMillis, long maxMillis)
 Whether to look again later: the main thread is given minMillis in any case (what the exit posted, the players' releases and the second cancel of the notifications, runs in that time), and after that for as long as something (a service that is started, a feed that gives the group its stream back) still runs and maxMillis is not used up.
 

Static Public Attributes

static final String STEP_MARK = "mark the exit"
 
static final String STEP_SHARES = "close the shares"
 
static final String STEP_SNAPCAST_NOTE = "note the Snapcast client ending"
 
static final String STEP_PLAYERS = "exit the players"
 
static final String STEP_SERVICES = "stop the services"
 
static final String STEP_NOTIFICATIONS = "cancel the notifications"
 
static final String STEP_TASKS = "finish the tasks"
 
static final String STEP_END = "end the process"
 

Detailed Description

The steps of the exit of the app in the order they are added (tasks 12.2 and 12.9): the players first (they release their media session and their notification, and a Snapcast player gives the group its stream back), then the services, then the notifications, then the end of the process.

A step that throws is noted and the next one runs all the same: the process must end, and one stuck player must not leave the services, the notifications or the process behind.

Plain Java, the steps are injected; Yaacc.exit() is the one that builds it (a source guard pins that).

Member Function Documentation

◆ run()

Result de.yaacc.util.ExitSequence.run ( )

Runs the steps in order; every one is isolated.

Never throws.

Referenced by de.yaacc.Yaacc.exit().

Here is the caller graph for this function:

◆ shouldKeepWaiting()

static boolean de.yaacc.util.ExitSequence.shouldKeepWaiting ( boolean somethingStillRunning,
long waitedMillis,
long minMillis,
long maxMillis )
static

Whether to look again later: the main thread is given minMillis in any case (what the exit posted, the players' releases and the second cancel of the notifications, runs in that time), and after that for as long as something (a service that is started, a feed that gives the group its stream back) still runs and maxMillis is not used up.

The wait is bounded, the exit is never held for good.


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