| Package | com.bourre.commands |
| Interface | public interface Runnable |
| Subinterfaces | ASyncCommand, Cancelable, Suspendable |
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Runnable interface should be implemented by any
class whose instances are intended to be executed asynchronously.
The class must define a method of no arguments called run.
This interface is designed to provide a common protocol for objects
that wish to execute code while they are active. For example,
Runnable is implemented by interface Tween
or ASyncCommand. Being active simply means that an
asynchronous process has been started and has not yet been stopped.
Concret implementations must take care that a process is considered
as running only if there is an active computation. More formally,
if the operation is paused, suspended (as defined by the
Suspendable interface or any other interface), the
object is considered as not running.
To go further, and to make clear the differents reflections about the run concept, I will detail the notion with the loading example. We could consider that a loading is not running inasmuch as the bytes loaded doesn't change since the last check. In that approach we can make the timeout detection more accurate by not esteem systematically that a slow loading is a failing loading.
The rules which defines the interruption clauses of a Runnable
are not defined here. Sub-interfaces such Suspendable and
Cancelable provides methods to allow users to interrupt the
operation in slightly different ways.
There's no restriction about how concret classes implements or not
a notification of their process completion. More formally, there's
many possible ending for an asynchronous process, such failure, success
or user interruption, it is the reason why there's many interface which
extends the Runnable interface to define process ending rules.
| Method | Defined by | ||
|---|---|---|---|
|
isRunning():Boolean
Returns
true if this object is running. | Runnable | ||
|
run():void
Starts the asynchronous process of this runnable object.
| Runnable | ||
| isRunning | () | method |
public function isRunning():Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if this object is running.
Boolean — true if this object is running.
|
| run | () | method |
public function run():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Starts the asynchronous process of this runnable object.
The contract for concret implementations of the run
method is that the Runnable object must be considered
as running as result of the call. Except if an exception was throw
during the call.
— IllegalStateException — if the run
method have been called wheras the operation is currently
running.
|
|
— IllegalStateException — if the object cannot
be run for any reasons.
|