com.atlassian.util.concurrent
Class ThreadFactories

java.lang.Object
  extended by com.atlassian.util.concurrent.ThreadFactories

public class ThreadFactories
extends java.lang.Object

Factory for creating ThreadFactory instances. All factory implementations produce named threads to give good stack-traces.


Nested Class Summary
static class ThreadFactories.Type
           
 
Method Summary
static java.util.concurrent.ThreadFactory namedThreadFactory(java.lang.String name)
          Get a ThreadFactory with the required name prefix.
static java.util.concurrent.ThreadFactory namedThreadFactory(java.lang.String name, ThreadFactories.Type type)
          Get a ThreadFactory with the required name prefix and type (user or daemon).
static java.util.concurrent.ThreadFactory namedThreadFactory(java.lang.String name, ThreadFactories.Type type, int priority)
          Get a ThreadFactory with the required name prefix, type and priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

namedThreadFactory

public static java.util.concurrent.ThreadFactory namedThreadFactory(@NotNull
                                                                    java.lang.String name)
Get a ThreadFactory with the required name prefix. The produced threads are user threads and have normal priority.

Parameters:
name - the prefix to use for naming the threads.
Returns:
a configured ThreadFactory

namedThreadFactory

public static java.util.concurrent.ThreadFactory namedThreadFactory(@NotNull
                                                                    java.lang.String name,
                                                                    @NotNull
                                                                    ThreadFactories.Type type)
Get a ThreadFactory with the required name prefix and type (user or daemon). The produced threads have normal priority.

Parameters:
name - the prefix to use for naming the threads.
type - whether they are User or Daemon threads.
Returns:
a configured ThreadFactory

namedThreadFactory

public static java.util.concurrent.ThreadFactory namedThreadFactory(@NotNull
                                                                    java.lang.String name,
                                                                    @NotNull
                                                                    ThreadFactories.Type type,
                                                                    int priority)
Get a ThreadFactory with the required name prefix, type and priority.

Parameters:
name - the prefix to use for naming the threads.
type - whether they are User or Daemon threads.
priority - the thread priority, must not be lower than Thread.MIN_PRIORITY or greater than Thread.MAX_PRIORITY
Returns:
a configured ThreadFactory


Copyright © 2011 Atlassian. All Rights Reserved.