The Meta-Environment API

toolbus.adapter
Class ToolBridge.JobQueue

java.lang.Object
  extended by toolbus.adapter.ToolBridge.JobQueue
Enclosing class:
ToolBridge

private class ToolBridge.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  ToolBridge.Job current
           
private  java.util.List<ToolBridge.Job> jobs
           
 
Constructor Summary
ToolBridge.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).
 ToolBridge.Job getNext()
          Returns the next job in the queue.
 void post(ToolBridge.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<ToolBridge.Job> jobs

current

private ToolBridge.Job current
Constructor Detail

ToolBridge.JobQueue

public ToolBridge.JobQueue()
Default constructor.

Method Detail

post

public void post(ToolBridge.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 ToolBridge.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