|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfj.control.parallel.Actor<A>
public final class Actor<A>
Light weight actors for Java. Concurrency is controlled by a parallel Strategy. The Strategy serves as the Actor's execution engine, and as its mailbox.
Given some effect, the Actor performs the effect on its messages using its Strategy, transforming them into unit-products. The unit-product represents a possibly running computation which is executing the effect. NOTE: An value of this type may process more than one message at a time, depending on its Strategy, and so is generally not thread safe unless its Effect is. For an actor that processes only one message at a time, seeQueueActor
.
Author: Runar
Method Summary | ||
---|---|---|
P1<Unit> |
act(A a)
Pass a message to this actor, applying its side-effect to the message. |
|
static
|
actor(Strategy<Unit> s,
Effect<A> e)
Creates a new Actor that uses the given parallelization strategy and has the given side-effect. |
|
static
|
actor(Strategy<Unit> s,
F<A,P1<Unit>> e)
Creates a new Actor that uses the given parallelization strategy and has the given side-effect. |
|
|
comap(F<B,A> f)
Contravariant functor pattern. |
|
Actor<Promise<A>> |
promise()
Transforms this actor to an actor on promises. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <A> Actor<A> actor(Strategy<Unit> s, Effect<A> e)
s
- The parallelization strategy to use for the new Actor.e
- The side-effect to apply to messages passed to the Actor.
public static <A> Actor<A> actor(Strategy<Unit> s, F<A,P1<Unit>> e)
s
- The parallelization strategy to use for the new Actor.e
- The function projection of a side-effect to apply to messages passed to the Actor.
public P1<Unit> act(A a)
a
- The message to send to this actor.
public <B> Actor<B> comap(F<B,A> f)
f
- The function to use for the transformation
public Actor<Promise<A>> promise()
|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |