|
YAACC - UPNP Client and Server
|
Remembers which share keys each player used, so that the shares can be released when the player ends. More...
Public Member Functions | |
| void | onPlayerAdded (P player, Collection< String > keys) |
| A player became active. | |
| void | refresh (P player, Collection< String > keys) |
| Adds keys the player is known to use now (union with what was remembered). | |
| Set< String > | onPlayerRemoved (P player) |
| The player ended: forgets it. | |
| Set< String > | keysOf (P player) |
| int | trackedPlayers () |
Static Public Member Functions | |
| static String | keyOfProxyPath (String path, String proxySegment) |
The share key in the path of a proxy URL (/proxy/<key> or /proxy/<deviceId>/<key>): the last segment, if the path starts with the proxy segment and the segment is a well-formed key. | |
Remembers which share keys each player used, so that the shares can be released when the player ends.
The keys must NOT be read from the player's item list at that moment: a player clears its list when it is destroyed, and the "removed" notification is delivered later (on the main thread), so the list is already empty by then. The glue therefore feeds this tracker early and often (onPlayerAdded, refresh); keys are only ever added, never forgotten, until the player is removed.
Players are tracked by identity (a replaced player can have the same id as its successor). Plain Java and thread safe: it is fed from the thread that removes a player and read on the main thread.
| <P> | the player type |
|
static |
The share key in the path of a proxy URL (/proxy/<key> or /proxy/<deviceId>/<key>): the last segment, if the path starts with the proxy segment and the segment is a well-formed key.
| path | the decoded URL path, may be null |
| proxySegment | the first path segment of the proxy routes, without slashes |
Referenced by de.yaacc.upnp.UpnpClient.createPlayableItem(), and de.yaacc.upnp.UpnpClient.discardShareOf().
| Set< String > de.yaacc.share.ShareKeyTracker< P >.keysOf | ( | P | player | ) |
| void de.yaacc.share.ShareKeyTracker< P >.onPlayerAdded | ( | P | player, |
| Collection< String > | keys ) |
A player became active.
Same as refresh: the player's items may be set before or after this call.
| Set< String > de.yaacc.share.ShareKeyTracker< P >.onPlayerRemoved | ( | P | player | ) |
The player ended: forgets it.
| void de.yaacc.share.ShareKeyTracker< P >.refresh | ( | P | player, |
| Collection< String > | keys ) |
Adds keys the player is known to use now (union with what was remembered).
Malformed keys are ignored; a player that never had a key is not stored.
Referenced by de.yaacc.player.ShareLifetimeListener.itemsSet(), de.yaacc.share.ShareKeyTracker< P >.onPlayerAdded(), and de.yaacc.player.ShareLifetimeListener.onPlayerRemoving().
| int de.yaacc.share.ShareKeyTracker< P >.trackedPlayers | ( | ) |