The Meta-Environment API

toolbus
Class AbstractTool.JobQueue

java.lang.Object
  extended by toolbus.AbstractTool.JobQueue
Enclosing class:
AbstractTool

private class AbstractTool.JobQueue
extends java.lang.Object

This job queue holds all the jobs that are send from a single source.

Author:
Arnold Lankamp

Field Summary
private  AbstractTool.Job current
           
private  java.util.List<AbstractTool.Job> jobs
           
 
Constructor Summary
AbstractTool.JobQueue()
          Default constructor.
 
Method Summary
 void ackEvent()
          Acknowledges the last event that was send from the source this queue is associated with.
private  void acknowledge()
          Notifies the thread local queue of the acknowledgement and executes the next queued job (if present).
 AbstractTool.Job getNext()
          Returns the next job in the queue.
 void post(AbstractTool.Job job)
          Schedules the given job for transmission to the ToolBus.
 void recResponse(aterm.ATermAppl response)
          Acknowledges the last request that was send from the source this queue is associated with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jobs

private final java.util.List<AbstractTool.Job> jobs

current

private AbstractTool.Job current
Constructor Detail

AbstractTool.JobQueue

public AbstractTool.JobQueue()
Default constructor.

Method Detail

post

public void post(AbstractTool.Job job)
Schedules the given job for transmission to the ToolBus. If there are currently no jobs in the queue, the event will be send immediately; otherwise we'll need to wait till all the requests (of the same source) that where previously scheduled have been send and acknowledged.

Parameters:
job - A container that hold the details about the request.

getNext

public AbstractTool.Job getNext()
Returns the next job in the queue.

Returns:
The next job in the queue; null if the queue is empty.

acknowledge

private void acknowledge()
Notifies the thread local queue of the acknowledgement and executes the next queued job (if present).


ackEvent

public void ackEvent()
Acknowledges the last event that was send from the source this queue is associated with. It will execute the next job in the queue if there are any.


recResponse

public void recResponse(aterm.ATermAppl response)
Acknowledges the last request that was send from the source this queue is associated with. It will execute the next job in the queue if there are any.

Parameters:
response - The response.

The Meta-Environment API