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

public abstract Class AbstractExecutorTaskRunnerFactory

extends Object
implements TaskRunnerFactory
Class Inheritance
All Implemented Interfaces
com.mchange.v2.c3p0.TaskRunnerFactory
Known Direct Subclasses
com.mchange.v2.c3p0.FixedThreadPoolExecutorTaskRunnerFactory
Imports
java.util.HashMap, .HashSet, .Timer, .TimerTask, java.util.concurrent.Executor, .ExecutorService, javax.sql.ConnectionPoolDataSource, com.mchange.v2.async.*, com.mchange.v2.log.*, com.mchange.v2.util.ResourceClosedException

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract class
AbstractExecutorTaskRunnerFactory.AbstractExecutorAsynchronousRunner

This implementation includes uninformative stub implementations of


  public int getThreadCount()      { return -1; }
  public int getIdleCount()        { return -1; }
  public int getPendingTaskCount() { return -1; }
  

Field Summary

Modifier and TypeField and Description
private static final StackTraceElement[]
private static final MLogger
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract ThreadPoolReportingAsynchronousRunner
public ThreadPoolReportingAsynchronousRunner
createTaskRunner(int num_threads_if_supported, int max_administrative_task_time_if_supported, String contextClassLoaderSourceIfSupported, boolean privilege_spawned_threads_if_supported, String threadLabelIfSupported, ConnectionPoolDataSource cpds, Timer timer)

Implements com.mchange.v2.c3p0.TaskRunnerFactory.createTaskRunner.

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

protected abstract Executor
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

protected HashMap<K, V>
protected abstract boolean
taskRunnerOwnsExecutor()

If the task runner will "own" the Executor it finds/creates, then when the task runner is closed() so to will the Executor be.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_STACK_TRACESback to summary
private static final StackTraceElement[] EMPTY_STACK_TRACES
loggerback to summary
private static final MLogger logger
SEPback to summary
private static final String SEP

Constructor Detail

AbstractExecutorTaskRunnerFactoryback to summary
public AbstractExecutorTaskRunnerFactory()

Method Detail

createTaskRunnerback to summary
protected abstract ThreadPoolReportingAsynchronousRunner createTaskRunner(TaskRunnerInit init, Timer timer)
createTaskRunnerback to summary
public ThreadPoolReportingAsynchronousRunner createTaskRunner(int num_threads_if_supported, int max_administrative_task_time_if_supported, String contextClassLoaderSourceIfSupported, boolean privilege_spawned_threads_if_supported, String threadLabelIfSupported, ConnectionPoolDataSource cpds, Timer timer)

Implements com.mchange.v2.c3p0.TaskRunnerFactory.createTaskRunner.

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

findCreateExecutorback to summary
protected abstract Executor findCreateExecutor(TaskRunnerInit init)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

otherPropertiesFromConnectionPoolDataSourceback to summary
protected HashMap<K, V> otherPropertiesFromConnectionPoolDataSource(ConnectionPoolDataSource cpds)
taskRunnerOwnsExecutorback to summary
protected abstract boolean taskRunnerOwnsExecutor()

If the task runner will "own" the Executor it finds/creates, then when the task runner is closed() so to will the Executor be.

com.mchange.v2.c3p0 back to summary

protected abstract Class AbstractExecutorTaskRunnerFactory.AbstractExecutorAsynchronousRunner

extends Object
implements ThreadPoolReportingAsynchronousRunner
Class Inheritance
  • java.lang.Object
  • com.mchange.v2.c3p0.AbstractExecutorTaskRunnerFactory.AbstractExecutorAsynchronousRunner
All Implemented Interfaces
com.mchange.v2.async.ThreadPoolReportingAsynchronousRunner, com.mchange.v2.async.AsynchronousRunner, com.mchange.v1.util.ClosableResource
Known Direct Subclasses
com.mchange.v2.c3p0.FixedThreadPoolExecutorTaskRunnerFactory.FixedThreadPoolExecutorAsynchronousRunner

This implementation includes uninformative stub implementations of

  public int getThreadCount()      { return -1; }
  public int getIdleCount()        { return -1; }
  public int getPendingTaskCount() { return -1; }
  
Consider overriding those if you can!

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private HashSet<E>
protected final TaskRunnerInit
private boolean
private final int
protected final Timer
private Executor
x

private Object

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected synchronized int
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.

protected Executor
public int
public int
public int
public String
public String
public int
protected synchronized boolean
public synchronized void
protected synchronized void
protected synchronized HashSet<E>
protected synchronized void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activeWrapperRunnablesback to summary
private HashSet<E> activeWrapperRunnables
initback to summary
protected final TaskRunnerInit init
is_closedback to summary
private boolean is_closed
matt_msback to summary
private final int matt_ms
timerback to summary
protected final Timer timer
xback to summary
private Executor x
xlockback to summary
private Object xlock

Constructor Detail

AbstractExecutorAsynchronousRunnerback to summary
protected AbstractExecutorAsynchronousRunner(TaskRunnerInit init, Timer timer)

Method Detail

activeCountback to summary
protected synchronized int activeCount()
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 ).

executorback to summary
protected Executor executor()
getActiveCountback to summary
public int getActiveCount()

Implements com.mchange.v2.async.ThreadPoolReportingAsynchronousRunner.getActiveCount.

getIdleCountback to summary
public int getIdleCount()

Implements com.mchange.v2.async.ThreadPoolReportingAsynchronousRunner.getIdleCount.

getPendingTaskCountback to summary
public int getPendingTaskCount()

Implements com.mchange.v2.async.ThreadPoolReportingAsynchronousRunner.getPendingTaskCount.

getStackTracesback to summary
public String getStackTraces()

Implements com.mchange.v2.async.ThreadPoolReportingAsynchronousRunner.getStackTraces.

getStatusback to summary
public String getStatus()

Implements com.mchange.v2.async.ThreadPoolReportingAsynchronousRunner.getStatus.

getThreadCountback to summary
public int getThreadCount()

Implements com.mchange.v2.async.ThreadPoolReportingAsynchronousRunner.getThreadCount.

isClosedback to summary
protected synchronized boolean isClosed()
postRunnableback to summary
public synchronized void postRunnable(Runnable r)

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

registerActiveback to summary
protected synchronized void registerActive(AbstractExecutorTaskRunnerFactory.AbstractExecutorAsynchronousRunner.WrapperRunnable wr)
snapshotActivesback to summary
protected synchronized HashSet<E> snapshotActives()
unregisterActiveback to summary
protected synchronized void unregisterActive(AbstractExecutorTaskRunnerFactory.AbstractExecutorAsynchronousRunner.WrapperRunnable wr)
com.mchange.v2.c3p0 back to summary

private final Class AbstractExecutorTaskRunnerFactory.AbstractExecutorAsynchronousRunner.WrapperRunnable

extends Object
implements Runnable
Class Inheritance
  • java.lang.Object
  • com.mchange.v2.c3p0.AbstractExecutorTaskRunnerFactory.AbstractExecutorAsynchronousRunner.WrapperRunnable
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
pack-priv Thread
pack-priv Runnable

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public synchronized String
public synchronized StackTraceElement[]
public synchronized void
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

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

Field Detail

carrierback to summary
pack-priv Thread carrier
innerback to summary
pack-priv Runnable inner

Constructor Detail

WrapperRunnableback to summary
pack-priv WrapperRunnable(Runnable inner)

Method Detail

getCarrierNameback to summary
public synchronized String getCarrierName()
getStackTraceback to summary
public synchronized StackTraceElement[] getStackTrace()
interruptback to summary
public synchronized void interrupt()
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

setCarrierback to summary
private synchronized void setCarrier(Thread t)