Package jetbrains.buildServer.util
Class NamedThreadFactory
- java.lang.Object
-
- jetbrains.buildServer.util.NamedThreadFactory
-
- All Implemented Interfaces:
java.util.concurrent.ThreadFactory
- Direct Known Subclasses:
NamedDaemonThreadFactory
,PositionNamedDaemonThreadFactory
public class NamedThreadFactory extends java.lang.Object implements java.util.concurrent.ThreadFactory
-
-
Constructor Summary
Constructors Constructor Description NamedThreadFactory(java.lang.String namePrefix)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
executeWithNewThreadName(java.lang.String newDetails, java.lang.Runnable action)
Inserts newDetails to the thread name and executes given action.static <T> T
executeWithNewThreadName(java.lang.String newDetails, java.util.concurrent.Callable<T> action)
Same asexecuteWithNewThreadName(String, Runnable)
but for Callablestatic <E extends java.lang.Throwable>
voidexecuteWithNewThreadNameActionThrow(java.lang.String newDetails, ActionThrow<E> action)
Same asexecuteWithNewThreadName(String, Runnable)
but for arbitrary thrown exceptionstatic <T,E extends java.lang.Throwable>
TexecuteWithNewThreadNameFuncThrow(java.lang.String newDetails, FuncThrow<T,E> function)
Same asexecuteWithNewThreadName(String, Runnable)
but for arbitrary thrown exceptionjava.lang.String
getThreadDump()
Deprecated.useDiagnosticUtil
java.lang.Thread
newThread(java.lang.Runnable r)
static jetbrains.buildServer.util.Disposable
patchThreadName(java.lang.String newDetails)
java.lang.String
toString()
static java.lang.String
updateThreadName(java.lang.String newDetails)
Deprecated.
-
-
-
Method Detail
-
updateThreadName
@Deprecated public static java.lang.String updateThreadName(@NotNull java.lang.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 java.lang.Thread newThread(@NotNull java.lang.Runnable r)
- Specified by:
newThread
in interfacejava.util.concurrent.ThreadFactory
-
getThreadDump
public java.lang.String getThreadDump()
Deprecated.useDiagnosticUtil
- Returns:
- complete thread dump
-
executeWithNewThreadName
public static void executeWithNewThreadName(@NotNull java.lang.String newDetails, @NotNull java.lang.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 java.lang.String newDetails, @NotNull java.util.concurrent.Callable<T> action) throws java.lang.Exception
Same asexecuteWithNewThreadName(String, Runnable)
but for Callable- Parameters:
newDetails
- new details to set in thread nameaction
- action to execute- Throws:
java.lang.Exception
- Since:
- 8.1
-
executeWithNewThreadNameFuncThrow
public static <T,E extends java.lang.Throwable> T executeWithNewThreadNameFuncThrow(@NotNull java.lang.String newDetails, @NotNull FuncThrow<T,E> function) throws E extends java.lang.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 java.lang.Throwable
- Since:
- 2017.1
-
executeWithNewThreadNameActionThrow
public static <E extends java.lang.Throwable> void executeWithNewThreadNameActionThrow(@NotNull java.lang.String newDetails, @NotNull ActionThrow<E> action) throws E extends java.lang.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 java.lang.Throwable
- Since:
- 2022.1
-
patchThreadName
@NotNull public static jetbrains.buildServer.util.Disposable patchThreadName(@NotNull java.lang.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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-