Top Description Inners Fields Constructors Methods
com.mchange.v2.async

public Class RoundRobinAsynchronousRunner

extends Object
implements AsynchronousRunner, Queuable
Class Inheritance
All Implemented Interfaces
com.mchange.v2.async.Queuable, com.mchange.v2.async.AsynchronousRunner, com.mchange.v1.util.ClosableResource
Imports
com.mchange.v2.log.*, com.mchange.v2.util.ResourceClosedException

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private static final MLogger
pack-priv final RunnableQueue[]
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
public
RoundRobinAsynchronousRunner(int num_threads, boolean daemon)

Method Summary

Modifier and TypeMethod and Description
public synchronized RunnableQueue
pack-priv static void
attemptClose(RunnableQueue rq, boolean skip_remaining_tasks)

public synchronized void
close(boolean
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.
skip_remaining_tasks
)

Implements com.mchange.v2.async.AsynchronousRunner.close.

Finish with this AsynchronousRunner, and clean-up any Threads or resources it may hold.

public void
close()

Implements com.mchange.v2.async.AsynchronousRunner.close.

Clean-up resources held by this asynchronous runner as soon as possible.

public synchronized void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private static final MLogger logger
rqsback to summary
pack-priv final RunnableQueue[] rqs
task_turnback to summary
pack-priv int task_turn
view_turnback to summary
pack-priv int view_turn

Constructor Detail

RoundRobinAsynchronousRunnerback to summary
public RoundRobinAsynchronousRunner(int num_threads, boolean daemon)

Method Detail

asRunnableQueueback to summary
public synchronized RunnableQueue asRunnableQueue()

Implements com.mchange.v2.async.Queuable.asRunnableQueue.

attemptCloseback to summary
pack-priv static void attemptClose(RunnableQueue rq, boolean skip_remaining_tasks)
closeback to summary
public synchronized void close(boolean skip_remaining_tasks)

Implements com.mchange.v2.async.AsynchronousRunner.close.

Doc from com.mchange.v2.async.AsynchronousRunner.close.

Finish with this AsynchronousRunner, and clean-up any Threads or resources it may hold.

Parameters
skip_remaining_tasks:boolean

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.

closeback to summary
public void close()

Implements com.mchange.v2.async.AsynchronousRunner.close.

Doc from com.mchange.v2.async.AsynchronousRunner.close.

Clean-up resources held by this asynchronous runner as soon as possible. Remaining tasks are skipped if possible, and any tasks executing when close() is called may or may not be interrupted. Equivalent to close( true ).

postRunnableback to summary
public synchronized void postRunnable(Runnable r)

Implements com.mchange.v2.async.AsynchronousRunner.postRunnable.

com.mchange.v2.async back to summary

pack-priv Class RoundRobinAsynchronousRunner.RunnableQueueView

extends Object
implements RunnableQueue
Class Inheritance
  • java.lang.Object
  • com.mchange.v2.async.RoundRobinAsynchronousRunner.RunnableQueueView
All Implemented Interfaces
com.mchange.v2.async.RunnableQueue, com.mchange.v2.async.AsynchronousRunner, com.mchange.v1.util.ClosableResource

Field Summary

Modifier and TypeField and Description
pack-priv final int

Constructor Summary

AccessConstructor and Description
pack-priv
RunnableQueueView(int rq_num)

Method Summary

Modifier and TypeMethod and Description
public void
close(boolean
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.
skip_remaining_tasks
)

Implements com.mchange.v2.async.AsynchronousRunner.close.

Finish with this AsynchronousRunner, and clean-up any Threads or resources it may hold.

public void
close()

Implements com.mchange.v2.async.AsynchronousRunner.close.

Clean-up resources held by this asynchronous runner as soon as possible.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rq_numback to summary
pack-priv final int rq_num

Constructor Detail

RunnableQueueViewback to summary
pack-priv RunnableQueueView(int rq_num)

Method Detail

closeback to summary
public void close(boolean skip_remaining_tasks)

Implements com.mchange.v2.async.AsynchronousRunner.close.

Doc from com.mchange.v2.async.AsynchronousRunner.close.

Finish with this AsynchronousRunner, and clean-up any Threads or resources it may hold.

Parameters
skip_remaining_tasks:boolean

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.

closeback to summary
public void close()

Implements com.mchange.v2.async.AsynchronousRunner.close.

Doc from com.mchange.v2.async.AsynchronousRunner.close.

Clean-up resources held by this asynchronous runner as soon as possible. Remaining tasks are skipped if possible, and any tasks executing when close() is called may or may not be interrupted. Equivalent to close( true ).

postRunnableback to summary
public void postRunnable(Runnable r)

Implements com.mchange.v2.async.AsynchronousRunner.postRunnable.