Package org.jbrew.concurrent
Interface Task<T>
- Type Parameters:
T
- Generic of type "T" is explicitly defined at compile-time.
Example:
public class TaskImplementor<T> implements Task<T>{ }
- All Superinterfaces:
java.lang.Runnable
- All Known Subinterfaces:
SerializableTask<T>
- All Known Implementing Classes:
AbstractTask
,BasicTask
,MethodBlockingTask
,ObjectBlockingTask
,RetrievableTask
,StandardNonRetrievableTask
public interface Task<T>
extends java.lang.Runnable
A concrete Task is an object which has the ability to be wrapped inside of a
Thread
- in the same manner as a Runnable
for multiple thread execution.
The advantage to use a Task however, lies with with its extended capabilities from that of a Runnable
.
For example, an ObjectBlockingTask
handles blocking and synchronization for objects in contention. As such, downstream consumers of Tasks are easily able to integrate multithreading into their own applications, without worrying about race conditions.- Author:
- Neal Kumar
-
Method Summary
Modifier and Type Method Description java.lang.String
getName()
int
getPriority()
long
getThreadId()
void
setName(java.lang.String name)
Sets the name of theTask
.void
setPriority(int priority)
-
Method Details
-
getName
java.lang.String getName()- Returns:
- Returns the
String
name of theTask
.
-
setName
void setName(java.lang.String name)Sets the name of theTask
.- Parameters:
name
- - theString
"name" for theTask
.
-
getThreadId
long getThreadId()- Returns:
- Returns the
long
id of theTask
's Thread.
-
setPriority
void setPriority(int priority) -
getPriority
int getPriority()
-