Package jetbrains.buildServer.util
Class NamedThreadFactory
- java.lang.Object
-
- jetbrains.buildServer.util.NamedThreadFactory
-
- All Implemented Interfaces:
ThreadFactory
- Direct Known Subclasses:
NamedDaemonThreadFactory
,PositionNamedDaemonThreadFactory
public class NamedThreadFactory extends Object implements ThreadFactory
-
-
Constructor Summary
Constructors Constructor Description NamedThreadFactory(String namePrefix)
-
Method Summary
-
-
-
Constructor Detail
-
NamedThreadFactory
public NamedThreadFactory(String namePrefix)
-
-
Method Detail
-
updateThreadName
@Deprecated public static String updateThreadName(@NotNull String newDetails)
Deprecated.Update current thread name to include new details- Parameters:
newDetails
- Thread name details, should not include timestamp and should not include previous thread name- Returns:
- Previous thread name
-
newThread
@NotNull public Thread newThread(@NotNull Runnable r)
- Specified by:
newThread
in interfaceThreadFactory
-
getThreadDump
public String getThreadDump()
Deprecated.useDiagnosticUtil
- Returns:
- complete thread dump
-
executeWithNewThreadName
public static void executeWithNewThreadName(@NotNull String newDetails, @NotNull Runnable action)
Inserts newDetails to the thread name and executes given action. Restores original thread name when action finishes.- Parameters:
newDetails
- new details to set in thread nameaction
- action to execute- Since:
- 7.1.4
-
executeWithNewThreadName
public static <T> T executeWithNewThreadName(@NotNull String newDetails, @NotNull Callable<T> action) throws Exception
Same asexecuteWithNewThreadName(String, Runnable)
but for Callable- Parameters:
newDetails
- new details to set in thread nameaction
- action to execute- Throws:
Exception
- Since:
- 8.1
-
executeWithNewThreadNameFuncThrow
public static <T,E extends Throwable> T executeWithNewThreadNameFuncThrow(@NotNull String newDetails, @NotNull FuncThrow<T,E> function) throws E extends Throwable
Same asexecuteWithNewThreadName(String, Runnable)
but for arbitrary thrown exception- Parameters:
newDetails
- new details to set in thread namefunction
- function to execute- Throws:
E extends Throwable
- Since:
- 2017.1
-
executeWithNewThreadNameActionThrow
public static <E extends Throwable> void executeWithNewThreadNameActionThrow(@NotNull String newDetails, @NotNull ActionThrow<E> action) throws E extends Throwable
Same asexecuteWithNewThreadName(String, Runnable)
but for arbitrary thrown exception- Parameters:
newDetails
- new details to set in thread nameaction
- action to execute- Throws:
E extends Throwable
- Since:
- 2022.1
-
patchThreadName
@NotNull public static Disposable patchThreadName(@NotNull String newDetails)
- Parameters:
newDetails
- new details to add to thread name- Returns:
- Disposable which should be disposed manually to return original thread name
- Since:
- 8.1
-
-