# Uses of Interface
java.lang.Runnable

Packages that use Runnable
Package
Description
java.awt
Contains all of the classes for creating user interfaces and for painting graphics and images.
java.awt.event
Provides interfaces and classes for dealing with different types of events fired by AWT components.
java.awt.image.renderable
Provides classes and interfaces for producing rendering-independent images.
java.lang
Provides classes that are fundamental to the design of the Java programming language.
java.lang.ref
Provides reference-object classes, which support a limited degree of interaction with the garbage collector.
java.util
Contains the collections framework, some internationalization support classes, a service loader, properties, random number generation, string parsing and scanning classes, base64 encoding and decoding, a bit array, and several miscellaneous utility classes.
java.util.concurrent
Utility classes commonly useful in concurrent programming.
java.util.logging
Provides the classes and interfaces of the Java 2 platform's core logging facilities.
java.util.stream
Classes to support functional-style operations on streams of elements, such as map-reduce transformations on collections.
javax.net.ssl
Provides classes for the secure socket package.
javax.swing
Provides a set of "lightweight" (all-Java language) components that, to the maximum degree possible, work the same on all platforms.
javax.swing.text
Provides classes and interfaces that deal with editable and noneditable text components.
jdk.jfr
This package provides classes to create events and control Flight Recorder.
jdk.jfr.consumer
This package contains classes for consuming Flight Recorder data.
jdk.management.jfr
This package contains classes to control and monitor Flight Recorder over Java Management Extensions (JMX).

- ## Uses of Runnable in java.awt

  Methods in java.awt with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `static void`
  EventQueue.`invokeAndWait(Runnable runnable)`
  Causes `runnable` to have its `run` method called in the `dispatch thread` of `the system EventQueue`.
  `static void`
  EventQueue.`invokeLater(Runnable runnable)`
  Causes `runnable` to have its `run` method called in the `dispatch thread` of `the system EventQueue`.

- ## Uses of Runnable in java.awt.event

  Fields in java.awt.event declared as Runnable
  Modifier and Type
  Field
  Description
  `protected Runnable`
  InvocationEvent.`runnable`
  The Runnable whose run() method will be called.
  Constructors in java.awt.event with parameters of type Runnable
  Modifier
  Constructor
  Description
  `protected`
  `InvocationEvent(Object source, int id, Runnable runnable, Object notifier, boolean catchThrowables)`
  Constructs an `InvocationEvent` with the specified source and ID which will execute the runnable's `run()` method when dispatched.
  ``
  `InvocationEvent(Object source, Runnable runnable)`
  Constructs an `InvocationEvent` with the specified source which will execute the runnable's `run()` method when dispatched.
  ``
  `InvocationEvent(Object source, Runnable runnable, Object notifier, boolean catchThrowables)`
  Constructs an `InvocationEvent` with the specified source which will execute the runnable's `run()` method when dispatched.
  ``
  `InvocationEvent(Object source, Runnable runnable, Runnable listener, boolean catchThrowables)`
  Constructs an `InvocationEvent` with the specified source which will execute the runnable's `run()` method when dispatched.

- ## Uses of Runnable in java.awt.image.renderable

  Classes in java.awt.image.renderable that implement Runnable
  Modifier and Type
  Class
  Description
  `class`
  `RenderableImageProducer`
  An adapter class that implements ImageProducer to allow the asynchronous production of a RenderableImage.

- ## Uses of Runnable in java.lang

  Classes in java.lang that implement Runnable
  Modifier and Type
  Class
  Description
  `class`
  `Thread`
  A thread is a thread of execution in a program.
  Methods in java.lang with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `void`
  ScopedValue.Carrier.`run(Runnable op)`
  Runs an operation with each scoped value in this mapping bound to its value in the current thread.
  `static <T> void`
  ScopedValue.`runWhere(ScopedValuePREVIEW<T> key, T value, Runnable op)`
  Run an operation with a `ScopedValue` bound to a value in the current thread.
  `Thread`
  Thread.Builder.`start(Runnable task)`
  Creates a new `Thread` from the current state of the builder and schedules it to execute.
  `static Thread`
  Thread.`startVirtualThread(Runnable task)`
  Creates a virtual thread to execute a task and schedules it to execute.
  `Thread`
  Thread.Builder.`unstarted(Runnable task)`
  Creates a new `Thread` from the current state of the builder to run the given task.
  Constructors in java.lang with parameters of type Runnable
  Modifier
  Constructor
  Description
  ``
  `Thread(Runnable task)`
  Initializes a new platform `Thread`.
  ``
  `Thread(Runnable task, String name)`
  Initializes a new platform `Thread`.
  ``
  `Thread(ThreadGroup group, Runnable task)`
  Initializes a new platform `Thread`.
  ``
  `Thread(ThreadGroup group, Runnable task, String name)`
  Initializes a new platform `Thread` so that it has `task` as its run object, has the specified `name` as its name, and belongs to the thread group referred to by `group`.
  ``
  `Thread(ThreadGroup group, Runnable task, String name, long stackSize)`
  Initializes a new platform `Thread` so that it has `task` as its run object, has the specified `name` as its name, and belongs to the thread group referred to by `group`, and has the specified stack size.
  ``
  `Thread(ThreadGroup group, Runnable task, String name, long stackSize, boolean inheritInheritableThreadLocals)`
  Initializes a new platform `Thread` so that it has `task` as its run object, has the specified `name` as its name, belongs to the thread group referred to by `group`, has the specified `stackSize`, and inherits initial values for inheritable thread-local variables if `inheritThreadLocals` is `true`.

- ## Uses of Runnable in java.lang.ref

  Methods in java.lang.ref with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `Cleaner.Cleanable`
  Cleaner.`register(Object obj, Runnable action)`
  Registers an object and a cleaning action to run when the object becomes phantom reachable.

- ## Uses of Runnable in java.util

  Classes in java.util that implement Runnable
  Modifier and Type
  Class
  Description
  `class`
  `TimerTask`
  A task that can be scheduled for one-time or repeated execution by a `Timer`.
  Methods in java.util with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `void`
  Optional.`ifPresentOrElse(Consumer<? super T> action, Runnable emptyAction)`
  If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
  `void`
  OptionalDouble.`ifPresentOrElse(DoubleConsumer action, Runnable emptyAction)`
  If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
  `void`
  OptionalInt.`ifPresentOrElse(IntConsumer action, Runnable emptyAction)`
  If a value is present, performs the given action with the value, otherwise performs the given empty-based action.
  `void`
  OptionalLong.`ifPresentOrElse(LongConsumer action, Runnable emptyAction)`
  If a value is present, performs the given action with the value, otherwise performs the given empty-based action.

- ## Uses of Runnable in java.util.concurrent

  Subinterfaces of Runnable in java.util.concurrent
  Modifier and Type
  Interface
  Description
  `interface`
  `RunnableFuture<V>`
  A `Future` that is `Runnable`.
  `interface`
  `RunnableScheduledFuture<V>`
  A `ScheduledFuture` that is `Runnable`.
  Classes in java.util.concurrent that implement Runnable
  Modifier and Type
  Class
  Description
  `class`
  `ForkJoinWorkerThread`
  A thread managed by a `ForkJoinPool`, which executes `ForkJoinTask`s.
  `class`
  `FutureTask<V>`
  A cancellable asynchronous computation.
  Methods in java.util.concurrent that return types with arguments of type Runnable
  Modifier and Type
  Method
  Description
  `BlockingQueue<Runnable>`
  ScheduledThreadPoolExecutor.`getQueue()`
  Returns the task queue used by this executor.
  `BlockingQueue<Runnable>`
  ThreadPoolExecutor.`getQueue()`
  Returns the task queue used by this executor.
  `List<Runnable>`
  ExecutorService.`shutdownNow()`
  Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.
  `List<Runnable>`
  ForkJoinPool.`shutdownNow()`
  Possibly attempts to cancel and/or stop all tasks, and reject all subsequently submitted tasks.
  `List<Runnable>`
  ScheduledThreadPoolExecutor.`shutdownNow()`
  Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.
  `List<Runnable>`
  ThreadPoolExecutor.`shutdownNow()`
  Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.
  Methods in java.util.concurrent with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `static ForkJoinTask<?>`
  ForkJoinTask.`adapt(Runnable runnable)`
  Returns a new `ForkJoinTask` that performs the `run` method of the given `Runnable` as its action, and returns a null result upon `ForkJoinTask.join()`.
  `static <T> ForkJoinTask<T>`
  ForkJoinTask.`adapt(Runnable runnable, T result)`
  Returns a new `ForkJoinTask` that performs the `run` method of the given `Runnable` as its action, and returns the given result upon `ForkJoinTask.join()`.
  `protected void`
  ThreadPoolExecutor.`afterExecute(Runnable r, Throwable t)`
  Method invoked upon completion of execution of the given Runnable.
  `protected void`
  ThreadPoolExecutor.`beforeExecute(Thread t, Runnable r)`
  Method invoked prior to executing the given Runnable in the given thread.
  `static Callable<Object>`
  Executors.`callable(Runnable task)`
  Returns a `Callable` object that, when called, runs the given task and returns `null`.
  `static <T> Callable<T>`
  Executors.`callable(Runnable task, T result)`
  Returns a `Callable` object that, when called, runs the given task and returns the given result.
  `protected <V> RunnableScheduledFuture<V>`
  ScheduledThreadPoolExecutor.`decorateTask(Runnable runnable, RunnableScheduledFuture<V> task)`
  Modifies or replaces the task used to execute a runnable.
  `void`
  Executor.`execute(Runnable command)`
  Executes the given command at some time in the future.
  `void`
  ForkJoinPool.`execute(Runnable task)`
  `void`
  ScheduledThreadPoolExecutor.`execute(Runnable command)`
  Executes `command` with zero required delay.
  `void`
  ThreadPoolExecutor.`execute(Runnable command)`
  Executes the given task sometime in the future.
  `protected <T> RunnableFuture<T>`
  AbstractExecutorService.`newTaskFor(Runnable runnable, T value)`
  Returns a `RunnableFuture` for the given runnable and default value.
  `Thread`
  ThreadFactory.`newThread(Runnable r)`
  Constructs a new unstarted `Thread` to run the given runnable.
  `void`
  RejectedExecutionHandler.`rejectedExecution(Runnable r, ThreadPoolExecutor executor)`
  Method that may be invoked by a `ThreadPoolExecutor` when `execute` cannot accept a task.
  `void`
  ThreadPoolExecutor.AbortPolicy.`rejectedExecution(Runnable r, ThreadPoolExecutor e)`
  Always throws RejectedExecutionException.
  `void`
  ThreadPoolExecutor.CallerRunsPolicy.`rejectedExecution(Runnable r, ThreadPoolExecutor e)`
  Executes task r in the caller's thread, unless the executor has been shut down, in which case the task is discarded.
  `void`
  ThreadPoolExecutor.DiscardOldestPolicy.`rejectedExecution(Runnable r, ThreadPoolExecutor e)`
  Obtains and ignores the next task that the executor would otherwise execute, if one is immediately available, and then retries execution of task r, unless the executor is shut down, in which case task r is instead discarded.
  `void`
  ThreadPoolExecutor.DiscardPolicy.`rejectedExecution(Runnable r, ThreadPoolExecutor e)`
  Does nothing, which has the effect of discarding task r.
  `boolean`
  ThreadPoolExecutor.`remove(Runnable task)`
  Removes this task from the executor's internal queue if it is present, thus causing it not to be run if it has not already started.
  `CompletableFuture<Void>`
  CompletableFuture.`runAfterBoth(CompletionStage<?> other, Runnable action)`
  `CompletionStage<Void>`
  CompletionStage.`runAfterBoth(CompletionStage<?> other, Runnable action)`
  Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action.
  `CompletableFuture<Void>`
  CompletableFuture.`runAfterBothAsync(CompletionStage<?> other, Runnable action)`
  `CompletableFuture<Void>`
  CompletableFuture.`runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)`
  `CompletionStage<Void>`
  CompletionStage.`runAfterBothAsync(CompletionStage<?> other, Runnable action)`
  Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action using this stage's default asynchronous execution facility.
  `CompletionStage<Void>`
  CompletionStage.`runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)`
  Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action using the supplied executor.
  `CompletableFuture<Void>`
  CompletableFuture.`runAfterEither(CompletionStage<?> other, Runnable action)`
  `CompletionStage<Void>`
  CompletionStage.`runAfterEither(CompletionStage<?> other, Runnable action)`
  Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action.
  `CompletableFuture<Void>`
  CompletableFuture.`runAfterEitherAsync(CompletionStage<?> other, Runnable action)`
  `CompletableFuture<Void>`
  CompletableFuture.`runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)`
  `CompletionStage<Void>`
  CompletionStage.`runAfterEitherAsync(CompletionStage<?> other, Runnable action)`
  Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action using this stage's default asynchronous execution facility.
  `CompletionStage<Void>`
  CompletionStage.`runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)`
  Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action using the supplied executor.
  `static CompletableFuture<Void>`
  CompletableFuture.`runAsync(Runnable runnable)`
  Returns a new CompletableFuture that is asynchronously completed by a task running in the `ForkJoinPool.commonPool()` after it runs the given action.
  `static CompletableFuture<Void>`
  CompletableFuture.`runAsync(Runnable runnable, Executor executor)`
  Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor after it runs the given action.
  `ScheduledFuture<?>`
  ScheduledExecutorService.`schedule(Runnable command, long delay, TimeUnit unit)`
  Submits a one-shot task that becomes enabled after the given delay.
  `ScheduledFuture<?>`
  ScheduledThreadPoolExecutor.`schedule(Runnable command, long delay, TimeUnit unit)`
  `ScheduledFuture<?>`
  ScheduledExecutorService.`scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)`
  Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence after `initialDelay`, then `initialDelay + period`, then `initialDelay + 2 * period`, and so on.
  `ScheduledFuture<?>`
  ScheduledThreadPoolExecutor.`scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)`
  Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence after `initialDelay`, then `initialDelay + period`, then `initialDelay + 2 * period`, and so on.
  `ScheduledFuture<?>`
  ScheduledExecutorService.`scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)`
  Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.
  `ScheduledFuture<?>`
  ScheduledThreadPoolExecutor.`scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)`
  Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.
  `Future<?>`
  AbstractExecutorService.`submit(Runnable task)`
  `<T> Future<T>`
  AbstractExecutorService.`submit(Runnable task, T result)`
  `Future<V>`
  CompletionService.`submit(Runnable task, V result)`
  Submits a Runnable task for execution and returns a Future representing that task.
  `Future<V>`
  ExecutorCompletionService.`submit(Runnable task, V result)`
  `Future<?>`
  ExecutorService.`submit(Runnable task)`
  Submits a Runnable task for execution and returns a Future representing that task.
  `<T> Future<T>`
  ExecutorService.`submit(Runnable task, T result)`
  Submits a Runnable task for execution and returns a Future representing that task.
  `ForkJoinTask<?>`
  ForkJoinPool.`submit(Runnable task)`
  `<T> ForkJoinTask<T>`
  ForkJoinPool.`submit(Runnable task, T result)`
  `Future<?>`
  ScheduledThreadPoolExecutor.`submit(Runnable task)`
  `<T> Future<T>`
  ScheduledThreadPoolExecutor.`submit(Runnable task, T result)`
  `CompletableFuture<Void>`
  CompletableFuture.`thenRun(Runnable action)`
  `CompletionStage<Void>`
  CompletionStage.`thenRun(Runnable action)`
  Returns a new CompletionStage that, when this stage completes normally, executes the given action.
  `CompletableFuture<Void>`
  CompletableFuture.`thenRunAsync(Runnable action)`
  `CompletableFuture<Void>`
  CompletableFuture.`thenRunAsync(Runnable action, Executor executor)`
  `CompletionStage<Void>`
  CompletionStage.`thenRunAsync(Runnable action)`
  Returns a new CompletionStage that, when this stage completes normally, executes the given action using this stage's default asynchronous execution facility.
  `CompletionStage<Void>`
  CompletionStage.`thenRunAsync(Runnable action, Executor executor)`
  Returns a new CompletionStage that, when this stage completes normally, executes the given action using the supplied Executor.
  Constructors in java.util.concurrent with parameters of type Runnable
  Modifier
  Constructor
  Description
  ``
  `CyclicBarrier(int parties, Runnable barrierAction)`
  Creates a new `CyclicBarrier` that will trip when the given number of parties (threads) are waiting upon it, and which will execute the given barrier action when the barrier is tripped, performed by the last thread entering the barrier.
  ``
  `FutureTask(Runnable runnable, V result)`
  Creates a `FutureTask` that will, upon running, execute the given `Runnable`, and arrange that `get` will return the given result on successful completion.
  Constructor parameters in java.util.concurrent with type arguments of type Runnable
  Modifier
  Constructor
  Description
  ``
  `ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue)`
  Creates a new `ThreadPoolExecutor` with the given initial parameters, the default thread factory and the default rejected execution handler.
  ``
  `ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler)`
  Creates a new `ThreadPoolExecutor` with the given initial parameters and the default thread factory.
  ``
  `ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)`
  Creates a new `ThreadPoolExecutor` with the given initial parameters and the default rejected execution handler.
  ``
  `ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)`
  Creates a new `ThreadPoolExecutor` with the given initial parameters.

- ## Uses of Runnable in java.util.logging

  Methods in java.util.logging with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `LogManager`
  LogManager.`addConfigurationListener(Runnable listener)`
  Adds a configuration listener to be invoked each time the logging configuration is read.
  `void`
  LogManager.`removeConfigurationListener(Runnable listener)`
  Removes a previously registered configuration listener.

- ## Uses of Runnable in java.util.stream

  Methods in java.util.stream with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `S`
  BaseStream.`onClose(Runnable closeHandler)`
  Returns an equivalent stream with an additional close handler.

- ## Uses of Runnable in javax.net.ssl

  Methods in javax.net.ssl that return Runnable
  Modifier and Type
  Method
  Description
  `abstract Runnable`
  SSLEngine.`getDelegatedTask()`
  Returns a delegated `Runnable` task for this `SSLEngine`.

- ## Uses of Runnable in javax.swing

  Classes in javax.swing that implement Runnable
  Modifier and Type
  Class
  Description
  `class`
  `SwingWorker<T,V>`
  An abstract class to perform lengthy GUI-interaction tasks in a background thread.
  Methods in javax.swing with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `static void`
  SwingUtilities.`invokeAndWait(Runnable doRun)`
  Causes `doRun.run()` to be executed synchronously on the AWT event dispatching thread.
  `static void`
  SwingUtilities.`invokeLater(Runnable doRun)`
  Causes doRun.run() to be executed asynchronously on the AWT event dispatching thread.

- ## Uses of Runnable in javax.swing.text

  Classes in javax.swing.text that implement Runnable
  Modifier and Type
  Class
  Description
  `class`
  `AsyncBoxView.ChildState`
  A record representing the layout state of a child view.
  Methods in javax.swing.text that return Runnable
  Modifier and Type
  Method
  Description
  `protected Runnable`
  LayoutQueue.`waitForWork()`
  Used by the worker thread to get a new task to execute.
  Methods in javax.swing.text with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `void`
  LayoutQueue.`addTask(Runnable task)`
  Add a task that is not needed immediately because the results are not believed to be visible.
  `void`
  AbstractDocument.`render(Runnable r)`
  This allows the model to be safely rendered in the presence of currency, if the model supports being updated asynchronously.
  `void`
  Document.`render(Runnable r)`
  Allows the model to be safely rendered in the presence of concurrency, if the model supports being updated asynchronously.

- ## Uses of Runnable in jdk.jfr

  Methods in jdk.jfr with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `static void`
  FlightRecorder.`addPeriodicEvent(Class<? extends Event> eventClass, Runnable hook)`
  Adds a hook for a periodic event.
  `static boolean`
  FlightRecorder.`removePeriodicEvent(Runnable hook)`
  Removes a hook for a periodic event.

- ## Uses of Runnable in jdk.jfr.consumer

  Methods in jdk.jfr.consumer with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `void`
  EventStream.`onClose(Runnable action)`
  Registers an action to perform when the stream is closed.
  `void`
  RecordingStream.`onClose(Runnable action)`
  `void`
  EventStream.`onFlush(Runnable action)`
  Registers an action to perform after the stream has been flushed.
  `void`
  RecordingStream.`onFlush(Runnable action)`

- ## Uses of Runnable in jdk.management.jfr

  Methods in jdk.management.jfr with parameters of type Runnable
  Modifier and Type
  Method
  Description
  `void`
  RemoteRecordingStream.`onClose(Runnable action)`
  `void`
  RemoteRecordingStream.`onFlush(Runnable action)`