org.jtoolkit.essence.concurrency
Class Threads

java.lang.Object
  extended by org.jtoolkit.essence.concurrency.Threads

public class Threads
extends java.lang.Object

Author:
Peter Lawrey

Field Summary
static java.lang.String CONTROL_THREAD
           
static java.lang.String INTERRUPTED
           
static java.lang.String LOGICAL_PROCESS
           
 
Method Summary
static void clearDefaultSES()
          Remove the default ScheduledExecutorService
static void createDefaultSES()
          Create a default ScheduledExecutorService for processing callbacks for threaded outside the container.
static java.util.concurrent.ScheduledExecutorService createMultiSES(java.lang.String name, int maxThreads, int priority)
           
static java.util.concurrent.ScheduledExecutorService createSingleSES(java.lang.String name)
          Create a single threaded ScheduledExecutorService
static java.util.concurrent.ScheduledExecutorService createSingleSES(java.lang.String name, int priority)
           
static boolean dumpStack(java.lang.Thread thread, java.lang.StackTraceElement[] stackTraceElements)
          Log the threads stack dump.
static void dumpStacks()
          Dump all thread stacks in a summarised form.
static java.util.concurrent.ScheduledExecutorService getCurrentSES()
           
static java.lang.Runnable getWeakRunnable(java.lang.Runnable run)
           
static boolean isNotThreadSafe(java.lang.Object component)
           
static java.util.concurrent.Future onTimeout(Timeout timeout, java.lang.Runnable runnable)
          When a timeout occurs run the Runnable (unless cancelled).
static void shutdown(java.util.concurrent.ExecutorService executorService)
           
static java.lang.String stackSnapshot()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTROL_THREAD

public static final java.lang.String CONTROL_THREAD
See Also:
Constant Field Values

LOGICAL_PROCESS

public static final java.lang.String LOGICAL_PROCESS
See Also:
Constant Field Values

INTERRUPTED

public static final java.lang.String INTERRUPTED
See Also:
Constant Field Values
Method Detail

createSingleSES

@NotNull
public static java.util.concurrent.ScheduledExecutorService createSingleSES(@NotNull
                                                                                    java.lang.String name)
Create a single threaded ScheduledExecutorService

Parameters:
name - of the thread in the SES
Returns:
the ScheduledExecutorService

createSingleSES

@NotNull
public static java.util.concurrent.ScheduledExecutorService createSingleSES(@NotNull
                                                                                    java.lang.String name,
                                                                                    int priority)

createMultiSES

@NotNull
public static java.util.concurrent.ScheduledExecutorService createMultiSES(@NotNull
                                                                                   java.lang.String name,
                                                                                   int maxThreads,
                                                                                   int priority)

dumpStacks

public static void dumpStacks()
Dump all thread stacks in a summarised form.


dumpStack

public static boolean dumpStack(@Nullable
                                java.lang.Thread thread,
                                @Nullable
                                java.lang.StackTraceElement[] stackTraceElements)
Log the threads stack dump.

Parameters:
thread -
stackTraceElements -

createDefaultSES

public static void createDefaultSES()
Create a default ScheduledExecutorService for processing callbacks for threaded outside the container.


clearDefaultSES

public static void clearDefaultSES()
Remove the default ScheduledExecutorService


getCurrentSES

public static java.util.concurrent.ScheduledExecutorService getCurrentSES()
Returns:
the ScheduledExecutorService for the current thread.

onTimeout

@Nullable
public static java.util.concurrent.Future onTimeout(Timeout timeout,
                                                             java.lang.Runnable runnable)
When a timeout occurs run the Runnable (unless cancelled).


stackSnapshot

public static java.lang.String stackSnapshot()

isNotThreadSafe

public static boolean isNotThreadSafe(@NotNull
                                      java.lang.Object component)

shutdown

public static void shutdown(java.util.concurrent.ExecutorService executorService)

getWeakRunnable

public static java.lang.Runnable getWeakRunnable(java.lang.Runnable run)


Copyright © Peter Lawrey. All Rights Reserved.