Class ThreadFactoryBuilder
java.lang.Object
com.google.common.util.concurrent.ThreadFactoryBuilder
Deprecated.
The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
A ThreadFactory builder, providing any combination of these features:
- whether threads should be marked as daemon threads
- a naming format
- a thread priority
- an uncaught exception handler
- a backing thread factory
If no backing thread factory is provided, a default backing thread factory is
used as if by calling setThreadFactory(
Executors.defaultThreadFactory()
)
.
- Since:
- 4.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Deprecated.Returns a new thread factory using the options supplied during the building process.setDaemon
(boolean daemon) Deprecated.Sets daemon or not for new threads created with this ThreadFactory.setNameFormat
(String nameFormat) Deprecated.Sets the naming format to use when naming threads (Thread.setName(java.lang.String)
) which are created with this ThreadFactory.setPriority
(int priority) Deprecated.Sets the priority for new threads created with this ThreadFactory.setThreadFactory
(ThreadFactory backingThreadFactory) Deprecated.Sets the backingThreadFactory
for new threads created with this ThreadFactory.setUncaughtExceptionHandler
(Thread.UncaughtExceptionHandler uncaughtExceptionHandler) Deprecated.Sets theThread.UncaughtExceptionHandler
for new threads created with this ThreadFactory.
-
Constructor Details
-
ThreadFactoryBuilder
public ThreadFactoryBuilder()Deprecated.Creates a newThreadFactory
builder.
-
-
Method Details
-
setNameFormat
Deprecated.Sets the naming format to use when naming threads (Thread.setName(java.lang.String)
) which are created with this ThreadFactory.- Parameters:
nameFormat
- aString.format(String, Object...)
-compatible format String, to which a unique integer (0, 1, etc.) will be supplied as the single parameter. This integer will be unique to the built instance of the ThreadFactory and will be assigned sequentially. For example,"rpc-pool-%d"
will generate thread names like"rpc-pool-0"
,"rpc-pool-1"
,"rpc-pool-2"
, etc.- Returns:
- this for the builder pattern
-
setDaemon
Deprecated.Sets daemon or not for new threads created with this ThreadFactory.- Parameters:
daemon
- whether or not new Threads created with this ThreadFactory will be daemon threads- Returns:
- this for the builder pattern
-
setPriority
Deprecated.Sets the priority for new threads created with this ThreadFactory.- Parameters:
priority
- the priority for new Threads created with this ThreadFactory- Returns:
- this for the builder pattern
-
setUncaughtExceptionHandler
public ThreadFactoryBuilder setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler) Deprecated.Sets theThread.UncaughtExceptionHandler
for new threads created with this ThreadFactory.- Parameters:
uncaughtExceptionHandler
- the uncaught exception handler for new Threads created with this ThreadFactory- Returns:
- this for the builder pattern
-
setThreadFactory
Deprecated.Sets the backingThreadFactory
for new threads created with this ThreadFactory. Threads will be created by invoking #newThread(Runnable) on this backingThreadFactory
.- Parameters:
backingThreadFactory
- the backingThreadFactory
which will be delegated to during thread creation.- Returns:
- this for the builder pattern
- See Also:
-
build
Deprecated.Returns a new thread factory using the options supplied during the building process. After building, it is still possible to change the options used to build the ThreadFactory and/or build again. State is not shared amongst built instances.- Returns:
- the fully constructed
ThreadFactory
-