|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.curjent.agent.FixedTasks
public class FixedTasks
Source for a fixed number of tasks.
This implementation is not thread-safe.
Field Summary | |
---|---|
private LinkedList<Object> |
queue
List of available tasks. |
Constructor Summary | |
---|---|
FixedTasks(Collection<Object> tasks)
Saves a copy of the given collection of tasks . |
|
FixedTasks(Object[] tasks)
Equivalent to FixedTasks(Arrays.asList(tasks)) . |
Method Summary | |
---|---|
Object |
acquire()
Removes and returns a task from our list of tasks. |
void |
release(Object task)
Adds the given task to our list of available tasks. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final LinkedList<Object> queue
Constructor Detail |
---|
public FixedTasks(Object[] tasks)
FixedTasks(Arrays.asList(tasks))
.
public FixedTasks(Collection<Object> tasks)
tasks
.
NullPointerException
- tasks
is null
.
IllegalArgumentException
- tasks
is empty.Method Detail |
---|
public Object acquire() throws Throwable
null
if our list is empty.
acquire
in interface AgentTasks
Throwable
- An unexpected error.Agent.newInstance(AgentLoader, Class[], AgentTasks, Class)
public void release(Object task) throws Throwable
task
to our list of available tasks.
release
in interface AgentTasks
NullPointerException
- tasks
is null
.
Throwable
- An unexpected error.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |