public class QueueWorkTickets<C>
extends java.lang.Object
Future
for waiting the result and allows adding a Callable
to
be run upon lease. The callable is run on a separate thread.Constructor and Description |
---|
QueueWorkTickets(int maximumTickets) |
Modifier and Type | Method and Description |
---|---|
void |
cancelAll() |
java.util.ArrayList<C> |
getAllWorkingClients() |
boolean |
isLeased(C client) |
boolean |
isQueued(C client) |
protected boolean |
lease(C client)
Call this to lease a working ticket.
|
java.util.concurrent.Future<java.lang.Boolean> |
leaseAndWait(C client)
The future will hold the lease result.
|
java.util.concurrent.Future<java.lang.Boolean> |
leaseAndWait(C client,
java.util.concurrent.Callable<java.lang.Boolean> callable)
The future will hold the lease result.
|
static void |
main(java.lang.String[] args) |
boolean |
release(C client) |
protected boolean lease(C client)
release(Object)
or periodically check with isLeased(Object)
.client
- public java.util.concurrent.Future<java.lang.Boolean> leaseAndWait(C client)
client
- public java.util.concurrent.Future<java.lang.Boolean> leaseAndWait(C client, java.util.concurrent.Callable<java.lang.Boolean> callable)
client
- callable
- public boolean isLeased(C client)
public boolean isQueued(C client)
public boolean release(C client)
public void cancelAll()
public java.util.ArrayList<C> getAllWorkingClients()
public static void main(java.lang.String[] args)
args
- Copyright © 2004-2020 FEUP-LSTS and Neptus developers. All Rights Reserved.