T
- Generic of type "T" is explicitly defined at compile-time.
public class TaskImplementor<T> implements Task<T>{ }
public interface Task<T> extends Runnable
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.Modifier and Type | Method and Description |
---|---|
String |
getName() |
int |
getPriority() |
long |
getThreadId() |
void |
setName(String name)
Sets the name of the
Task . |
void |
setPriority(int priority) |
Copyright © 2020. All rights reserved.