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

public Class CarefulRunnableQueue

extends Object
implements RunnableQueue, Queuable, StrandedTaskReporting
Class Inheritance
All Implemented Interfaces
com.mchange.v2.async.StrandedTaskReporting, com.mchange.v2.async.Queuable, com.mchange.v2.async.AsynchronousRunner, com.mchange.v1.util.ClosableResource, com.mchange.v2.async.RunnableQueue
Imports
java.util.Collections, .List, .LinkedList, com.mchange.v2.log.MLevel, .MLog, .MLogger, com.mchange.v2.util.ResourceClosedException

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private boolean
private static final MLogger
private boolean
private List<E>
private CarefulRunnableQueue.TaskThread
t

private List<E>

Constructor Summary

AccessConstructor and Description
public
CarefulRunnableQueue(boolean daemon, boolean shutdown_on_interrupt)

Method Summary

Modifier and TypeMethod and Description
public RunnableQueue
private synchronized void
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 synchronized void
close()

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

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

private synchronized Runnable
public synchronized List<E>
getStrandedTasks()

Implements com.mchange.v2.async.StrandedTaskReporting.getStrandedTasks.

makes available any tasks that were unperformed when this AsynchronousRunner was closed, either explicitly using close() or close( true ), or implicitly because some failure or corruption killed the Object (most likely a Thread interruption.

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

Field Detail

gentle_close_requestedback to summary
private boolean gentle_close_requested
loggerback to summary
private static final MLogger logger
shutdown_on_interruptback to summary
private boolean shutdown_on_interrupt
strandedTasksback to summary
private List<E> strandedTasks
tback to summary
private CarefulRunnableQueue.TaskThread t
taskListback to summary
private List<E> taskList

Constructor Detail

CarefulRunnableQueueback to summary
public CarefulRunnableQueue(boolean daemon, boolean shutdown_on_interrupt)

Method Detail

asRunnableQueueback to summary
public RunnableQueue asRunnableQueue()

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

awaitTaskback to summary
private synchronized void awaitTask() throws InterruptedException
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 synchronized 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 ).

dequeueRunnableback to summary
private synchronized Runnable dequeueRunnable()
getStrandedTasksback to summary
public synchronized List<E> getStrandedTasks()

Implements com.mchange.v2.async.StrandedTaskReporting.getStrandedTasks.

Doc from com.mchange.v2.async.StrandedTaskReporting.getStrandedTasks.

makes available any tasks that were unperformed when this AsynchronousRunner was closed, either explicitly using close() or close( true ), or implicitly because some failure or corruption killed the Object (most likely a Thread interruption.

Returns:List<E>

null if the AsynchronousRunner is still alive, a List of Runnables otherwise, which will be empty only if all tasks were performed before the AsynchronousRunner shut down.

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 CarefulRunnableQueue.TaskThread

extends Thread
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv boolean
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.

public synchronized void
private synchronized boolean
Inherited from java.lang.Thread:
activeCountcheckAccessclonecurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitsetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadstopthreadIdtoStringyield

Field Detail

should_stopback to summary
pack-priv boolean should_stop

Constructor Detail

TaskThreadback to summary
pack-priv TaskThread()

Method Detail

runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

safeStopback to summary
public synchronized void safeStop()
shouldStopback to summary
private synchronized boolean shouldStop()