Package org.littleshoot.proxy.impl
Class CategorizedThreadFactory
- java.lang.Object
-
- org.littleshoot.proxy.impl.CategorizedThreadFactory
-
- All Implemented Interfaces:
ThreadFactory
public class CategorizedThreadFactory extends Object implements ThreadFactory
A ThreadFactory that adds LittleProxy-specific information to the threads' names.
-
-
Field Summary
Fields Modifier and Type Field Description private Stringcategoryprivate static org.slf4j.Loggerlogprivate Stringnameprivate AtomicIntegerthreadCountprivate static Thread.UncaughtExceptionHandlerUNCAUGHT_EXCEPTION_HANDLERException handler for proxy threads.private intuniqueServerGroupId
-
Constructor Summary
Constructors Constructor Description CategorizedThreadFactory(String name, String category, int uniqueServerGroupId)
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
-
name
private final String name
-
category
private final String category
-
uniqueServerGroupId
private final int uniqueServerGroupId
-
threadCount
private final AtomicInteger threadCount
-
UNCAUGHT_EXCEPTION_HANDLER
private static final Thread.UncaughtExceptionHandler UNCAUGHT_EXCEPTION_HANDLER
Exception handler for proxy threads. Logs the name of the thread and the exception that was caught.
-
-
Constructor Detail
-
CategorizedThreadFactory
public CategorizedThreadFactory(String name, String category, int uniqueServerGroupId)
- Parameters:
name- the user-supplied name of this proxycategory- the type of threads this factory is creating (acceptor, client-to-proxy worker, proxy-to-server worker)uniqueServerGroupId- a unique number for the server group creating this thread factory, to differentiate multiple proxy instances with the same name
-
-
Method Detail
-
newThread
public Thread newThread(Runnable r)
- Specified by:
newThreadin interfaceThreadFactory
-
-