Stay organized with collections Save and categorize content based on your preferences.

IdlingScheduledThreadPoolExecutor

public class IdlingScheduledThreadPoolExecutor extends ScheduledThreadPoolExecutor


A ScheduledThreadPoolExecutor that can be registered as an IdlingResource with Espresso.

Overrides parent methods to monitor threads starting, and finishing execution. Uses CountingIdlingResource to track number of active tasks.

This API is currently in beta.

Summary

Public constructors

IdlingScheduledThreadPoolExecutor(
    String resourceName,
    int corePoolSize,
    ThreadFactory threadFactory
)

Creates a new IdlingScheduledThreadPoolExecutor with the given initial parameters.

IdlingScheduledThreadPoolExecutor(
    String resourceName,
    int corePoolSize,
    ThreadFactory threadFactory,
    boolean debugCounting
)

Creates a new IdlingScheduledThreadPoolExecutor with the given initial parameters.

Public methods

String
boolean
void
registerIdleTransitionCallback(ResourceCallback callback)
ScheduledFuture<Object>
schedule(Runnable command, long delay, TimeUnit unit)
ScheduledFuture<V>
<V> schedule(Callable<V> callable, long delay, TimeUnit unit)

Inherited methods

From java.util.concurrent.AbstractExecutorService
List<Future<T>>
<T> invokeAll(Collection<Callable<T>> tasks)
T
<T> invokeAny(Collection<Callable<T>> tasks)
From java.util.concurrent.ScheduledThreadPoolExecutor
void
execute(Runnable command)
boolean
boolean
BlockingQueue<Runnable>
boolean
ScheduledFuture<Object>
scheduleAtFixedRate(
    Runnable command,
    long initialDelay,
    long period,
    TimeUnit unit
)
ScheduledFuture<Object>
scheduleWithFixedDelay(
    Runnable command,
    long initialDelay,
    long delay,
    TimeUnit unit
)
void
void
void
setRemoveOnCancelPolicy(boolean value)
void
List<Runnable>
Future<Object>
Future<T>
<T> submit(Runnable task, T result)
From java.util.concurrent.ThreadPoolExecutor

Public constructors

IdlingScheduledThreadPoolExecutor

public IdlingScheduledThreadPoolExecutor(
    String resourceName,
    int corePoolSize,
    ThreadFactory threadFactory
)

Creates a new IdlingScheduledThreadPoolExecutor with the given initial parameters.

Parameters
String resourceName

the name of the executor (used for logging and idempotency of registration).

int corePoolSize

the number of threads to keep in the pool, even if they are idle, unless allowCoreThreadTimeOut is set.

ThreadFactory threadFactory

the factory to use when the executor creates a new thread.

IdlingScheduledThreadPoolExecutor

public IdlingScheduledThreadPoolExecutor(
    String resourceName,
    int corePoolSize,
    ThreadFactory threadFactory,
    boolean debugCounting
)

Creates a new IdlingScheduledThreadPoolExecutor with the given initial parameters.

Parameters
String resourceName

the name of the executor (used for logging and idempotency of registration).

int corePoolSize

the number of threads to keep in the pool, even if they are idle, unless allowCoreThreadTimeOut is set.

ThreadFactory threadFactory

the factory to use when the executor creates a new thread.

boolean debugCounting

if true increment &decrement calls will print trace information to logs.

Public methods

getName

public String getName()

isIdleNow

public boolean isIdleNow()

registerIdleTransitionCallback

public void registerIdleTransitionCallback(ResourceCallback callback)

schedule

public ScheduledFuture<Objectschedule(Runnable command, long delay, TimeUnit unit)

schedule

public ScheduledFuture<V> <V> schedule(Callable<V> callable, long delay, TimeUnit unit)