public class FabricThread
extends java.lang.Object
Title: Framework Support Library
Description: Defines a Fabric wrapper of the system Thread
.
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDescription()
Returns a description of the thread.
|
long |
getId()
Returns an identifier of the thread.
|
java.lang.management.ThreadInfo |
getInfo()
Returns an information about the thread.
|
java.lang.String |
getName()
Returns a name of the thread.
|
java.lang.Object |
getResult()
Waits until the thread will complete an execution of its task and returns a result of the execution.
|
java.lang.Object |
getResult(long timeout)
Waits until the thread will complete an execution of its task and returns a result of the execution.
|
java.lang.StackTraceElement[] |
getStackTrace()
Returns a stack trace of the thread.
|
long |
getStartTime()
Returns a start time of the thread.
|
java.lang.Object |
getUserData()
Returns a user data associated with the thread.
|
void |
interrupt()
Interrupts the thread.
|
boolean |
isDaemon()
Indicates if the thread is a daemon thread.
|
boolean |
isRunning()
Indicates if the thread is running.
|
void |
join()
Waits until the thread will complete an execution of its task.
|
void |
join(long timeout)
Waits until the thread will complete an execution of its task.
|
void |
kill()
Kills the thread immediately.
|
void |
setUserData(java.lang.Object userData)
Sets a user data associated with the thread.
|
void |
start()
Starts the thread.
|
void |
stop()
Tries to stop the thread.
|
java.lang.String |
toString() |
public void start()
Repeated start is not allowed. This method throws RejectedExecutionException
if the thread has been stopped before.
public void stop()
ExecutorService.shutdownNow()
).
The method does nothing if the thread belongs to pool.public void interrupt()
public void kill()
The method is unsafe and should be used very carefully. The method has undefined behavior if the thread belongs to pool.
public void join()
public void join(long timeout)
timeout
- the waiting time (in milliseconds) for completion of the task execution.public java.lang.Object getResult() throws java.util.concurrent.CancellationException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
null
if the thread belongs to pool.java.util.concurrent.CancellationException
- if the task execution was cancelled.java.lang.InterruptedException
- if the task execution was interrupted.java.util.concurrent.ExecutionException
- if any problem has appeared during the task execution.public java.lang.Object getResult(long timeout) throws java.util.concurrent.CancellationException, java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
null
if the thread belongs to pool.timeout
- the waiting time (in milliseconds) for completion of the task execution.java.util.concurrent.CancellationException
- if the task execution was cancelled.java.lang.InterruptedException
- if the task execution was interrupted.java.util.concurrent.ExecutionException
- if any problem has appeared during the task execution.java.util.concurrent.TimeoutException
- if the specified timeout has expired.public long getId()
public java.lang.String getName()
public java.lang.String getDescription()
public java.lang.management.ThreadInfo getInfo()
null
if the thread is not running.public long getStartTime()
public java.lang.StackTraceElement[] getStackTrace()
public java.lang.Object getUserData()
public void setUserData(java.lang.Object userData)
userData
- the user data to be set.public boolean isDaemon()
true
if the thread is a daemon thread, false
otherwise.public boolean isRunning()
true
if the thread is running, false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.