public class

IdlingScheduledThreadPoolExecutor

extends ScheduledThreadPoolExecutor
implements IdlingResource
java.lang.Object
   ↳ java.util.concurrent.AbstractExecutorService
     ↳ java.util.concurrent.ThreadPoolExecutor
       ↳ java.util.concurrent.ScheduledThreadPoolExecutor
         ↳ android.support.test.espresso.idling.concurrent.IdlingScheduledThreadPoolExecutor

Class Overview

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.
Public Methods
String getName()
boolean isIdleNow()
void registerIdleTransitionCallback(IdlingResource.ResourceCallback callback)
<V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
Protected Methods
void afterExecute(Runnable r, Throwable t)
void beforeExecute(Thread t, Runnable r)
void terminated()
[Expand]
Inherited Methods
From class java.util.concurrent.ScheduledThreadPoolExecutor
From class java.util.concurrent.ThreadPoolExecutor
From class java.util.concurrent.AbstractExecutorService
From class java.lang.Object
From interface java.util.concurrent.ScheduledExecutorService
From interface java.util.concurrent.ExecutorService
From interface android.support.test.espresso.IdlingResource
From interface java.util.concurrent.Executor

Public Constructors

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

Creates a new IdlingScheduledThreadPoolExecutor with the given initial parameters.

Parameters
resourceName String: the name of the executor (used for logging and idempotency of registration).
corePoolSize int: 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.

Public Methods

public String getName ()

Returns
String

public boolean isIdleNow ()

Returns
boolean

public void registerIdleTransitionCallback (IdlingResource.ResourceCallback callback)

Parameters
callback IdlingResource.ResourceCallback

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

Parameters
callable Callable
delay long
unit TimeUnit
Returns
ScheduledFuture<V>

public ScheduledFuture<?> schedule (Runnable command, long delay, TimeUnit unit)

Parameters
command Runnable
delay long
unit TimeUnit
Returns
ScheduledFuture<?>

Protected Methods

protected void afterExecute (Runnable r, Throwable t)

Parameters
r Runnable
t Throwable

protected void beforeExecute (Thread t, Runnable r)

Parameters
t Thread
r Runnable

protected void terminated ()