public abstract class Worker
extends java.lang.Object
Title: Framework Support Library
Description: Defines a sort of Worker based on user thread.
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
Modifier and Type | Method and Description |
---|---|
FabricThread |
getThread()
Returns the underlying thread of the worker.
|
boolean |
isSleeping()
Checks if the worker is sleeping.
|
boolean |
isStarted()
Checks if the worker is started.
|
void |
join()
Waits until the worker will complete an execution of its task.
|
void |
join(long timeout)
Waits until the worker will complete an execution of its task.
|
void |
run()
Executes the worker's task.
|
void |
sleep()
Causes the worker to sleep.
|
void |
start()
Starts an execution of the worker.
|
void |
stop()
Stops an execution of the worker.
|
void |
stop(boolean force)
Stops an execution of the worker.
|
void |
stop(long timeout)
Stops an execution of the worker.
|
void |
stop(long timeout,
boolean force)
Stops an execution of the worker.
|
java.lang.String |
toString() |
void |
wakeUp()
Wakes up the worker to continue execution of the task.
|
public void start()
public void stop()
The worker waits for 100
milliseconds until its thread completes the execution.
The worker tries to stop its thread in a normal way (not forcibly).
public void stop(boolean force)
If the parameter force
is positive, the worker tries to forcibly stop its thread
(if the thread has not stopped in a normal way).
The worker waits for 100
milliseconds until its thread completes the execution.
force
- indicates if a forced stopping is needed.public void stop(long timeout)
If the parameter timeout
is positive, the worker waits until its thread completes the execution.
Otherwise the worker tries to immediately stop its thread.
The worker tries to stop its thread in a normal way (not forcibly).
force
- indicates if a forced stopping is needed.public void stop(long timeout, boolean force)
If the parameter timeout
is positive, the worker waits until its thread completes the execution.
Otherwise the worker tries to immediately stop its thread.
If the parameter force
is positive, the worker tries to forcibly stop its thread
(if the thread has not stopped in a normal way).
timeout
- the waiting time (in milliseconds) for completion of the thread execution.force
- indicates if a forced stopping is needed.public boolean isStarted()
true
if the worker is started, false
otherwise.public void run()
run
in interface java.lang.Runnable
public void join()
public void join(long timeout)
timeout
- the waiting time (in milliseconds) of a completion of the task execution.public void wakeUp()
public void sleep()
public boolean isSleeping()
true
if the worker is sleeping, false
otherwise.public FabricThread getThread()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.