com.mchange.v2.async
Class RoundRobinAsynchronousRunner

java.lang.Object
  extended by com.mchange.v2.async.RoundRobinAsynchronousRunner
All Implemented Interfaces:
ClosableResource, AsynchronousRunner, Queuable

public class RoundRobinAsynchronousRunner
extends java.lang.Object
implements AsynchronousRunner, Queuable

A class that provides for effecient asynchronous execution of multiple tasks that may block, but that do not contend for the same locks. The order in which tasks will be executed is not guaranteed.


Constructor Summary
RoundRobinAsynchronousRunner(int num_threads, boolean daemon)
           
 
Method Summary
 RunnableQueue asRunnableQueue()
           
 void close()
          forces the release of any resources that might be associated with this object.
 void close(boolean skip_remaining_tasks)
          Finish with this AsynchronousRunner, and clean-up any Threads or resources it may hold.
 void postRunnable(java.lang.Runnable r)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoundRobinAsynchronousRunner

public RoundRobinAsynchronousRunner(int num_threads,
                                    boolean daemon)
Method Detail

postRunnable

public void postRunnable(java.lang.Runnable r)
Specified by:
postRunnable in interface AsynchronousRunner

asRunnableQueue

public RunnableQueue asRunnableQueue()
Specified by:
asRunnableQueue in interface Queuable

close

public void close(boolean skip_remaining_tasks)
Description copied from interface: AsynchronousRunner
Finish with this AsynchronousRunner, and clean-up any Threads or resources it may hold.

Specified by:
close in interface AsynchronousRunner
Parameters:
skip_remaining_tasks - Should be regarded as a hint, not a guarantee. If true, pending, not-yet-performed tasks will be skipped, if possible. Currently executing tasks may or may not be interrupted. If false, all previously scheduled tasks will be completed prior to clean-up. The method returns immediately regardless.

close

public void close()
Description copied from interface: ClosableResource
forces the release of any resources that might be associated with this object.

Specified by:
close in interface ClosableResource
Specified by:
close in interface AsynchronousRunner