Module java.base
Package java.lang

Interface Thread.Builder

All Known Subinterfaces:
Thread.Builder.OfPlatform,Thread.Builder.OfVirtual
Enclosing class:
Thread

public static sealed interfaceThread.BuilderpermitsThread.Builder.OfPlatform,Thread.Builder.OfVirtual
A builder forThread andThreadFactory objects.

Builder defines methods to setThread properties such as the threadname. This includes properties that would otherwise beinherited. Once set, aThread orThreadFactory is created with the following methods:

  • Theunstarted method creates a newunstartedThread to run a task. TheThread'sstart method must be invoked to schedule the thread to execute.
  • Thestart method creates a new Thread to run a task and schedules the thread to execute.
  • Thefactory method creates aThreadFactory.

AThread.Builder is not thread safe. TheThreadFactory returned by the builder'sfactory() method is thread safe.

Unless otherwise specified, passing a null argument to a method in this interface causes aNullPointerException to be thrown.

Since:
21
See Also: