uk.ac.ncl.cs.instantsoap.queue
Class LoggingQueue<T>

java.lang.Object
  extended by uk.ac.ncl.cs.instantsoap.queue.LoggingQueue<T>

public class LoggingQueue<T>
extends Object

A queue that runs runnables and informs listeners.

Author:
Matthew Pocock, Lewis

Nested Class Summary
static interface LoggingQueue.Listener<T>
          A Listener that is informed when things are submitted to or completed by the list.
 
Constructor Summary
LoggingQueue(CompletionService<T> runner)
          Create a new queue that uses the CompeltionService to run jobs.
 
Method Summary
 void addListener(LoggingQueue.Listener<T> listener)
          Add a listener to the queue.
 void removeListener(LoggingQueue.Listener<T> listener)
          Remove the listener from the queue.
 Future<T> submit(Runnable job, T ticket)
          Subkit a runnable with a ticket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingQueue

public LoggingQueue(CompletionService<T> runner)
Create a new queue that uses the CompeltionService to run jobs.

Parameters:
runner - the CompletionService to use
Method Detail

addListener

public void addListener(LoggingQueue.Listener<T> listener)
Add a listener to the queue.

Parameters:
listener - the Listener to add

removeListener

public void removeListener(LoggingQueue.Listener<T> listener)
Remove the listener from the queue.

Parameters:
listener - the Listener to remove

submit

public Future<T> submit(Runnable job,
                        T ticket)
Subkit a runnable with a ticket.

Parameters:
job - the Runnable to be queued
ticmet - the ticket that uniquely identifies this job
Returns:
a Future that will return the ticket when the job is completed


Copyright © 2006-2008. All Rights Reserved.