Groovy Documentation

gpars.agent
Class AgentCore

java.lang.Object
  gpars.agent.AgentCore
All Implemented Interfaces:
Runnable

@SuppressWarnings({"UnqualifiedStaticUsage"})
class AgentCore

author:
Vaclav Pech Date: 13.4.2010


Constructor Summary
AgentCore()

 
Method Summary
void attachToThreadPool(Pool threadPool)

Sets a new thread pool to be used by the agent

void call(Object message)

Adds the message to the agent\s message queue

List getErrors()

Retrieves a list of exception thrown within the agent's body.

Pool getThreadPool()

Retrieves the thread pool used by the agent

void handleMessage(Object message)

Dynamically dispatches the method call

boolean isFair()

Retrieves the agent's fairness flag Fair agents give up the thread after processing each message, non-fair agents keep a thread until their message queue is empty.

void leftShift(Object message)

Adds the message to the agent\s message queue

void makeFair()

Makes the agent fair.

void run()

Handles a single message from the message queue

void schedule()

Schedules processing of a next message, if there are some and if there isn't an active thread handling a message at the moment

void send(Object message)

Adds the message to the agent\s message queue

void setPGroup(PGroup pGroup)

Sets an actor group to use for task scheduling

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

AgentCore

AgentCore()


 
Method Detail

attachToThreadPool

public final void attachToThreadPool(Pool threadPool)
Sets a new thread pool to be used by the agent
param:
threadPool The thread pool to use


call

@SuppressWarnings({"UnusedDeclaration"})
public final void call(Object message)
Adds the message to the agent\s message queue
param:
message A value or a closure


getErrors

@SuppressWarnings({"SynchronizedMethod", "ReturnOfCollectionOrArrayField"})
public List getErrors()
Retrieves a list of exception thrown within the agent's body. Clears the exception history
return:
A detached collection of exception that have occurred in the agent's body


getThreadPool

public final Pool getThreadPool()
Retrieves the thread pool used by the agent
return:
The thread pool


handleMessage

public void handleMessage(Object message)
Dynamically dispatches the method call
param:
message A value or a closure


isFair

public boolean isFair()
Retrieves the agent's fairness flag Fair agents give up the thread after processing each message, non-fair agents keep a thread until their message queue is empty. Non-fair agents tends to perform better than fair ones.
return:
True for fair agents, false for non-fair ones. Agents are non-fair by default.


leftShift

@SuppressWarnings({"UnusedDeclaration"})
public final void leftShift(Object message)
Adds the message to the agent\s message queue
param:
message A value or a closure


makeFair

public void makeFair()
Makes the agent fair. Agents are non-fair by default. Fair agents give up the thread after processing each message, non-fair agents keep a thread until their message queue is empty. Non-fair agents tends to perform better than fair ones.


run

@SuppressWarnings({"CatchGenericClass"})
public void run()
Handles a single message from the message queue


schedule

public void schedule()
Schedules processing of a next message, if there are some and if there isn't an active thread handling a message at the moment


send

public final void send(Object message)
Adds the message to the agent\s message queue
param:
message A value or a closure


setPGroup

public void setPGroup(PGroup pGroup)
Sets an actor group to use for task scheduling
param:
pGroup The pGroup to use


 

Groovy Documentation