Remembers which registry keys no player has claimed yet.
Plain Java, thread-safe, time passed in.
Today only a player releases a share, so a share that no player ever picked up (the receiver went away, the player could not be created) would keep its registry slot, and for a file its open descriptor, until the absolute maximum of six hours. The glue calls registered right after ShareRegistry.register, claimed when a player took the key, released when it is given up in any other way, and from the sweeper dueForRemoval; the keys it returns are removed from the registry by the caller (which closes the source).
-
A key is due when it was registered MORE than the claim window ago (exactly at the window it is not yet due) and was neither claimed nor released.
dueForRemoval forgets the keys it returns, so each is reported once.
-
A
claimed or released that arrives before registered (a player can be fast) is remembered for a bounded number of keys and wins.
-
Bounded: at most
maxEntries keys are tracked. When a registration pushes the oldest one out, that key is not forgotten silently: it is queued and returned as due by the next dueForRemoval, so the caller still removes it. (That queue is itself capped at {@value MAX_OVERFLOW}; the registry holds only a few shares at once, so this is never reached in practice.)
-
All methods are idempotent; null and empty keys are ignored.