Groovy Documentation

gpars.agent
[Java] Class AgentCore

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

@SuppressWarnings({"UnqualifiedStaticUsage"})
public abstract class AgentCore

Authors:
Vaclav Pech Date: 13.4.2010


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

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 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
 

Method Detail

attachToThreadPool

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


call

@SuppressWarnings({"UnusedDeclaration"})
public final void call(Object message)
Adds the message to the agent\s message queue
Parameters:
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
Returns:
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
Returns:
The thread pool


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.
Returns:
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
Parameters:
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


send

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


setPGroup

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


 

Groovy Documentation