|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<ConcurrencyModel>
org.actorsguildframework.annotations.ConcurrencyModel
public enum ConcurrencyModel
ConcurrencyModel describes the way concurrency is handled in the actor and its methods.
| Enum Constant Summary | |
|---|---|
MultiThreaded
Specifies a multi-threaded model: several simultaneous thread can run in the actor. |
|
SingleThreaded
Specifies a single-threaded model: only one simultaneous thread in the actor is allowed. |
|
Stateless
Specifies a stateless model: several simultaneous thread can run in the actor, but they can not share any state in the actor. |
|
| Method Summary | |
|---|---|
boolean |
isMultiThreadingCapable()
Returns true if this model is multi-threaded, and thus either MultiThreaded or
Stateless. |
static ConcurrencyModel |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static ConcurrencyModel[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final ConcurrencyModel SingleThreaded
All messages will be processed in the order that they have been queued.
public static final ConcurrencyModel MultiThreaded
The order of execution for multi-threaded messages is not defined. Thus they may be executed in a different order than the order to queuing.
Please note that Stateless should be preferred to MultiThreaded where
possible, because it is much safer.
public static final ConcurrencyModel Stateless
Stateless works exactly like MultiThreaded. However,
at the first instantiation actors declared as Stateless
run through a number of checks to validate that the actor does not maintain
any state other than configuration data set at creation.
In order to ensure this, there are strict rules for Stateless actors.
In an actor that is declared as Stateless (using a
Model annotation for the class), there are the following restrictions
for the fields used in the actor and any super-classes:
final.
Prop annotated properties must properties using the
PropSynchronization PropSynchronization#Final (note that this
is the default for read-only properties without setter)
@Prop annotated properties must be
either Immutable (includes Java primitives and String), or an Actor,
or a multi-threading-safe class annotated with Shared
The order of execution for stateless messages is not defined. Thus they may be executed in a different order than the order to queuing.
| Method Detail |
|---|
public static final ConcurrencyModel[] values()
for(ConcurrencyModel c : ConcurrencyModel.values())
System.out.println(c);
public static ConcurrencyModel valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified namepublic boolean isMultiThreadingCapable()
MultiThreaded or
Stateless.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||