diff --git a/akka-docs/pending/typed-actors-java.rst b/akka-docs/pending/typed-actors-java.rst index a1d0d3594c..2322698ed1 100644 --- a/akka-docs/pending/typed-actors-java.rst +++ b/akka-docs/pending/typed-actors-java.rst @@ -23,13 +23,15 @@ If you have a POJO with an interface implementation separation like this: .. code-block:: java interface RegistrationService { - void register(User user, Credentials cred) - User getUserFor(String username) + void register(User user, Credentials cred); + User getUserFor(String username); } .. code-block:: java - public class RegistrationServiceImpl implements RegistrationService extends TypedActor { + import akka.actor.TypedActor; + + public class RegistrationServiceImpl extends TypedActor implements RegistrationService { public void register(User user, Credentials cred) { ... // register user } @@ -69,9 +71,12 @@ Using a configuration object: .. code-block:: java + import static java.util.concurrent.TimeUnit.MILLISECONDS; + import akka.actor.TypedActorConfiguration; + import akka.util.FiniteDuration; + TypedActorConfiguration config = new TypedActorConfiguration() - .timeout(3000) - .makeTransactionRequired(); + .timeout(new FiniteDuration(3000, MILLISECONDS)); RegistrationService service = (RegistrationService) TypedActor.newInstance(RegistrationService.class, config); @@ -161,7 +166,7 @@ Here is an example how you can use it to in a 'void' (e.g. fire-forget) method t class PingImpl implements Ping extends TypedActor { public void hit(int count) { - Pong pong = (Pong) context.getSender(); + Pong pong = (Pong) getContext().getSender(); pong.hit(count++); } } diff --git a/akka-docs/pending/typed-actors-scala.rst b/akka-docs/pending/typed-actors-scala.rst index 74a18527e9..3d03cc93b1 100644 --- a/akka-docs/pending/typed-actors-scala.rst +++ b/akka-docs/pending/typed-actors-scala.rst @@ -10,7 +10,7 @@ If you are using the `Spring Framework `_ then take a l Creating Typed Actors --------------------- -**IMPORTANT:** The Typed Actors class must have access modifier 'public' and can't be an inner class (unless it is an inner class in an 'object'). +**IMPORTANT:** The Typed Actors class must have access modifier 'public' (which is default) and can't be an inner class (unless it is an inner class in an 'object'). Akka turns POJOs with interface and implementation into asynchronous (Typed) Actors. Akka is using `AspectWerkz’s Proxy `_ implementation, which is the `most performant `_ proxy implementation there exists. @@ -22,6 +22,8 @@ If you have a POJO with an interface implementation separation like this: .. code-block:: scala + import akka.actor.TypedActor + trait RegistrationService { def register(user: User, cred: Credentials): Unit def getUserFor(username: String): User @@ -64,10 +66,12 @@ Configuration factory class Using a configuration object: .. code-block:: scala + import akka.actor.TypedActorConfiguration + import akka.util.Duration + import akka.util.duration._ - val config = new TypedActorConfiguration - .timeout(3000) - .makeTransactionRequired + val config = TypedActorConfiguration() + .timeout(3000 millis) val service = TypedActor.newInstance(classOf[RegistrationService], classOf[RegistrationServiceImpl], config)