|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.actorsguildframework.DefaultAgent
public class DefaultAgent
DefaultAgent is an implementation of the Agent interface.
| Nested Class Summary | |
|---|---|
static class |
DefaultAgent.Configuration
Represents a configuration for an Agent. |
| Constructor Summary | |
|---|---|
DefaultAgent()
Creates a new agent with a default configuration. |
|
DefaultAgent(DefaultAgent.Configuration configuration)
Creates a new agent with the given Configuration. |
|
| Method Summary | ||
|---|---|---|
void |
awaitAll(AsyncResult... asyncResults)
Waits until all given AsyncResults are available. |
|
void |
awaitAllUntilError(AsyncResult... asyncResults)
Waits until all given AsyncResults are available, and throws the WrappedException of the first AsyncResult that failed, if one failed. |
|
AsyncResult |
awaitAny(AsyncResult... asyncResults)
Waits until one of the given AsyncResults is available. |
|
|
create(Class<T> actorOrBeanClass)
Creates a new instance of the given Bean or Actor. |
|
|
create(Class<T> actorOrBeanClass,
Props props)
Creates a new instance of the given Bean or Actor and sets its properties. |
|
void |
shutdown()
Tries to shut down the agent with all its threads. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultAgent(DefaultAgent.Configuration configuration)
create(Class) to add actors to the agent.
configuration - the configuration to usepublic DefaultAgent()
create(Class) to add actors to the agent.
| Method Detail |
|---|
public <T> T create(Class<T> actorOrBeanClass)
AgentBean or Actor.
Create supports the following annotations:
create in interface AgentT - the type of the class to createactorOrBeanClass - the class to create
public <T> T create(Class<T> actorOrBeanClass,
Props props)
AgentBean or Actor and sets its properties.
Create supports the following annotations:
The second argument allows specifying values for the instance's properties.
The value of the Props must be compatible with the class of the property. If the
property is a primitive (like int), specify the wrapper type (Number sub-classes,
for example Integer). create also supports type conversion for all numeric
type, as well as between Character and Integer.
For those properties that are not given, the method will take the defined
DefaultValue, if specified, or the type's default value (null for references,
0 for number primitives, false for boolean).
create in interface AgentT - the type of the class to createactorOrBeanClass - the class to createprops - the values for the instance's properties. Null for no initial properties.
public void awaitAll(AsyncResult... asyncResults)
AgentawaitAll can be invoked from all threads, including those that do not process a message.
awaitAll in interface AgentasyncResults - the list of AsyncResult instances to wait forAgent.awaitAllUntilError(AsyncResult...),
Agent.awaitAny(AsyncResult...)public void awaitAllUntilError(AsyncResult... asyncResults)
AgentawaitAll can be invoked from all threads, including those that do not process a message.
awaitAllUntilError in interface AgentasyncResults - the list of AsyncResult instances to wait forAgent.awaitAll(AsyncResult...)public AsyncResult awaitAny(AsyncResult... asyncResults)
AgentawaitAny can be invoked from all threads, including those that do not process a message.
awaitAny in interface AgentasyncResults - the list of AsyncResult instances to wait for
Agent.awaitAll(AsyncResult...)public void shutdown()
Agent
This call is useful if you want to terminate your Java application. Without it, the Agent's
non-daemon threads may keep the application from terminating. A safer alternative to
shutdown may be calling System.exit(int), as there is no guarantee
that shutdown can terminate all threads.
A agent and its actors must not be used after calling this method. The behaviour would be undefined.
shutdown in interface Agent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||