public class FabricThreadManager
extends java.lang.Object
Title: Framework Support Library
Description: Defines a manager controlling instances of the FabricThread
.
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
Modifier and Type | Method and Description |
---|---|
FabricThread |
createDaemonThread(java.lang.String name,
java.lang.String description,
java.util.concurrent.Callable task)
Creates a new daemon thread with the specified name, description and
Callable task. |
FabricThread |
createDaemonThread(java.lang.String name,
java.lang.String description,
java.lang.Runnable task)
Creates a new daemon thread with the specified name, description and
Runnable task. |
FabricThreadPool |
createDaemonThreadPool(ThreadPoolType type,
java.lang.String name,
java.lang.String description,
int threadsNumber)
Creates a new pool of daemon threads.
|
FabricThreadPool |
createDaemonThreadPool(ThreadPoolType type,
java.lang.String name,
java.lang.String description,
int minThreadsNumber,
int maxThreadsNumber,
int maxQueueSize)
Creates a new pool of daemon threads.
|
FabricThread |
createThread(java.lang.String name,
java.lang.String description,
java.util.concurrent.Callable task)
Creates a new thread with the specified name, description and
Callable task. |
FabricThread |
createThread(java.lang.String name,
java.lang.String description,
java.lang.Runnable task)
Creates a new thread with the specified name, description and
Runnable task. |
FabricThreadPool |
createThreadPool(ThreadPoolType type,
java.lang.String name,
java.lang.String description,
int threadsNumber)
Creates a new pool of threads.
|
FabricThreadPool |
createThreadPool(ThreadPoolType type,
java.lang.String name,
java.lang.String description,
int minThreadsNumber,
int maxThreadsNumber,
int maxQueueSize)
Creates a new pool of threads.
|
static FabricThreadManager |
getInstance()
Returns an instance of the singleton.
|
java.lang.management.ThreadMXBean |
getThreadBean()
Returns a system thread bean.
|
java.util.List |
getThreads()
Returns a list of all threads controlled by the manager.
|
java.util.List |
getThreadsInfo()
Returns a list containing information about all threads.
|
boolean |
interruptThread(long threadId)
Interrupts the thread with the specified identifier.
|
boolean |
killThread(long threadId)
Kills the thread with the specified identifier immediately.
|
FabricThread |
lookupThread(long threadId)
Looks up and returns the thread with the specified identifier.
|
FabricThread |
lookupThread(java.lang.String name)
Looks up and returns the thread with the specified name.
|
public static FabricThreadManager getInstance()
public java.lang.management.ThreadMXBean getThreadBean()
public java.util.List getThreadsInfo()
public FabricThread createThread(java.lang.String name, java.lang.String description, java.lang.Runnable task)
Runnable
task.name
- the name of the thread.description
- the description of the thread.task
- the task to be executed by the thread.public FabricThread createThread(java.lang.String name, java.lang.String description, java.util.concurrent.Callable task)
Callable
task.name
- the name of the thread.description
- the description of the thread.task
- the task to be executed by the thread.public FabricThread createDaemonThread(java.lang.String name, java.lang.String description, java.lang.Runnable task)
Runnable
task.name
- the name of the thread.description
- the description of the thread.task
- the task to be executed by the thread.public FabricThread createDaemonThread(java.lang.String name, java.lang.String description, java.util.concurrent.Callable task)
Callable
task.name
- the name of the thread.description
- the description of the thread.task
- the task to be executed by the thread.public FabricThreadPool createThreadPool(ThreadPoolType type, java.lang.String name, java.lang.String description, int threadsNumber)
type
- the type of the pool.name
- the name of the pool.description
- the description of the pool.threadsNumber
- the maximum number of threads in the pool.public FabricThreadPool createThreadPool(ThreadPoolType type, java.lang.String name, java.lang.String description, int minThreadsNumber, int maxThreadsNumber, int maxQueueSize)
type
- the type of the pool.name
- the name of the pool.description
- the description of the pool.threadsNumber
- the maximum number of threads in the pool.minThreadsNumber
- the minimum number of threads in the pool.maxThreadsNumber
- the maximum number of threads in the pool.maxQueueSize
- the maximum queue size.public FabricThreadPool createDaemonThreadPool(ThreadPoolType type, java.lang.String name, java.lang.String description, int threadsNumber)
type
- the type of the pool.name
- the name of the pool.description
- the description of the pool.threadsNumber
- the maximum number of threads in the pool.public FabricThreadPool createDaemonThreadPool(ThreadPoolType type, java.lang.String name, java.lang.String description, int minThreadsNumber, int maxThreadsNumber, int maxQueueSize)
type
- the type of the pool.name
- the name of the pool.description
- the description of the pool.minThreadsNumber
- the minimum number of threads in the pool.maxThreadsNumber
- the maximum number of threads in the pool.maxQueueSize
- the maximum queue size.public FabricThread lookupThread(long threadId)
threadId
- the identifier of a thread to be looked up.null
if the thread is not found.public FabricThread lookupThread(java.lang.String name)
name
- the name of the thread to be looked up.null
if the thread is not found.public java.util.List getThreads()
public boolean killThread(long threadId)
threadId
- the identifier of the thread to be killed.true
if the corresponding thread is found and killed, false
otherwise.public boolean interruptThread(long threadId)
threadId
- the identifier of the thread to be interrupted.true
if the corresponding thread is found and interrupted, false
otherwise.Copyright © 2015-2024 StreamScape Technologies. All rights reserved.