Wrap long lines, for pdf
This commit is contained in:
parent
7c1ab68263
commit
95366cb585
27 changed files with 108 additions and 67 deletions
|
|
@ -319,20 +319,25 @@ akka {
|
|||
# an instance of that actor its mailbox type will be decided by looking
|
||||
# up a mailbox configuration via T in this mapping
|
||||
requirements {
|
||||
"akka.dispatch.UnboundedMessageQueueSemantics" = akka.actor.mailbox.unbounded-queue-based
|
||||
"akka.dispatch.DequeBasedMessageQueue" = akka.actor.mailbox.unbounded-deque-based
|
||||
"akka.dispatch.UnboundedDequeBasedMessageQueueSemantics" = akka.actor.mailbox.unbounded-deque-based
|
||||
"akka.dispatch.UnboundedMessageQueueSemantics" =
|
||||
akka.actor.mailbox.unbounded-queue-based
|
||||
"akka.dispatch.DequeBasedMessageQueue" =
|
||||
akka.actor.mailbox.unbounded-deque-based
|
||||
"akka.dispatch.UnboundedDequeBasedMessageQueueSemantics" =
|
||||
akka.actor.mailbox.unbounded-deque-based
|
||||
}
|
||||
|
||||
unbounded-queue-based {
|
||||
# FQCN of the MailboxType, The Class of the FQCN must have a public constructor
|
||||
# with (akka.actor.ActorSystem.Settings, com.typesafe.config.Config) parameters.
|
||||
# FQCN of the MailboxType, The Class of the FQCN must have a public
|
||||
# constructor with (akka.actor.ActorSystem.Settings,
|
||||
# com.typesafe.config.Config) parameters.
|
||||
mailbox-type = "akka.dispatch.UnboundedMailbox"
|
||||
}
|
||||
|
||||
unbounded-deque-based {
|
||||
# FQCN of the MailboxType, The Class of the FQCN must have a public constructor
|
||||
# with (akka.actor.ActorSystem.Settings, com.typesafe.config.Config) parameters.
|
||||
# FQCN of the MailboxType, The Class of the FQCN must have a public
|
||||
# constructor with (akka.actor.ActorSystem.Settings,
|
||||
# com.typesafe.config.Config) parameters.
|
||||
mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox"
|
||||
}
|
||||
}
|
||||
|
|
@ -504,11 +509,12 @@ akka {
|
|||
# on which file IO tasks are scheduled
|
||||
file-io-dispatcher = "akka.actor.default-dispatcher"
|
||||
|
||||
# The maximum number of bytes (or "unlimited") to transfer in one batch when using
|
||||
# `WriteFile` command which uses `FileChannel.transferTo` to pipe files to a TCP socket.
|
||||
# On some OS like Linux `FileChannel.transferTo` may block for a long time when network
|
||||
# IO is faster than file IO. Decreasing the value may improve fairness while increasing
|
||||
# may improve throughput.
|
||||
# The maximum number of bytes (or "unlimited") to transfer in one batch
|
||||
# when using `WriteFile` command which uses `FileChannel.transferTo` to
|
||||
# pipe files to a TCP socket. On some OS like Linux `FileChannel.transferTo`
|
||||
# may block for a long time when network IO is faster than file IO.
|
||||
# Decreasing the value may improve fairness while increasing may improve
|
||||
# throughput.
|
||||
file-io-transferTo-limit = 512 KiB
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ akka {
|
|||
roles = []
|
||||
|
||||
role {
|
||||
# Minimum required number of members of a certain role before the leader changes
|
||||
# member status of 'Joining' members to 'Up'. Typically used together with
|
||||
# 'Cluster.registerOnMemberUp' to defer some action, such as starting actors,
|
||||
# until the cluster has reached a certain size.
|
||||
# Minimum required number of members of a certain role before the leader
|
||||
# changes member status of 'Joining' members to 'Up'. Typically used together
|
||||
# with 'Cluster.registerOnMemberUp' to defer some action, such as starting
|
||||
# actors, until the cluster has reached a certain size.
|
||||
# E.g. to require 2 nodes with role 'frontend' and 3 nodes with role 'backend':
|
||||
# frontend.min-nr-of-members = 2
|
||||
# backend.min-nr-of-members = 3
|
||||
|
|
@ -87,7 +87,8 @@ akka {
|
|||
gossip-different-view-probability = 0.8
|
||||
|
||||
# Settings for the Phi accrual failure detector (http://ddg.jaist.ac.jp/pub/HDY+04.pdf
|
||||
# [Hayashibara et al]) used by the cluster subsystem to detect unreachable members.
|
||||
# [Hayashibara et al]) used by the cluster subsystem to detect unreachable
|
||||
# members.
|
||||
failure-detector {
|
||||
|
||||
# FQCN of the failure detector implementation.
|
||||
|
|
@ -168,10 +169,10 @@ akka {
|
|||
|
||||
# How quickly the exponential weighting of past data is decayed compared to
|
||||
# new data. Set lower to increase the bias toward newer values.
|
||||
# The relevance of each data sample is halved for every passing half-life duration,
|
||||
# i.e. after 4 times the half-life, a data sample’s relevance is reduced to 6% of
|
||||
# its original relevance. The initial relevance of a data sample is given by
|
||||
# 1 – 0.5 ^ (collect-interval / half-life).
|
||||
# The relevance of each data sample is halved for every passing half-life
|
||||
# duration, i.e. after 4 times the half-life, a data sample’s relevance is
|
||||
# reduced to 6% of its original relevance. The initial relevance of a data
|
||||
# sample is given by 1 – 0.5 ^ (collect-interval / half-life).
|
||||
# See http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
|
||||
moving-average-half-life = 12s
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ object ClusterSingletonManagerSpec extends MultiNodeConfig {
|
|||
// documentation of how to keep track of the oldest member in user land
|
||||
//#singleton-proxy
|
||||
class ConsumerProxy extends Actor {
|
||||
|
||||
// subscribe to MemberEvent, re-subscribe when restart
|
||||
override def preStart(): Unit =
|
||||
Cluster(context.system).subscribe(self, classOf[MemberEvent])
|
||||
|
|
@ -157,7 +158,8 @@ object ClusterSingletonManagerSpec extends MultiNodeConfig {
|
|||
val role = "worker"
|
||||
// sort by age, oldest first
|
||||
val ageOrdering = Ordering.fromLessThan[Member] { (a, b) ⇒ a.isOlderThan(b) }
|
||||
var membersByAge: immutable.SortedSet[Member] = immutable.SortedSet.empty(ageOrdering)
|
||||
var membersByAge: immutable.SortedSet[Member] =
|
||||
immutable.SortedSet.empty(ageOrdering)
|
||||
|
||||
def receive = {
|
||||
case state: CurrentClusterState ⇒
|
||||
|
|
@ -170,8 +172,8 @@ object ClusterSingletonManagerSpec extends MultiNodeConfig {
|
|||
}
|
||||
|
||||
def consumer: Option[ActorSelection] =
|
||||
membersByAge.headOption map (m ⇒ context.actorSelection(RootActorPath(m.address) /
|
||||
"user" / "singleton" / "consumer"))
|
||||
membersByAge.headOption map (m ⇒ context.actorSelection(
|
||||
RootActorPath(m.address) / "user" / "singleton" / "consumer"))
|
||||
}
|
||||
//#singleton-proxy
|
||||
|
||||
|
|
|
|||
|
|
@ -46,9 +46,11 @@ public class DistributedPubSubMediatorTest {
|
|||
LoggingAdapter log = Logging.getLogger(getContext().system(), this);
|
||||
|
||||
public Subscriber() {
|
||||
ActorRef mediator = DistributedPubSubExtension.get(getContext().system()).mediator();
|
||||
ActorRef mediator =
|
||||
DistributedPubSubExtension.get(getContext().system()).mediator();
|
||||
// subscribe to the topic named "content"
|
||||
mediator.tell(new DistributedPubSubMediator.Subscribe("content", getSelf()), getSelf());
|
||||
mediator.tell(new DistributedPubSubMediator.Subscribe("content", getSelf()),
|
||||
getSelf());
|
||||
}
|
||||
|
||||
public void onReceive(Object msg) {
|
||||
|
|
@ -67,13 +69,15 @@ public class DistributedPubSubMediatorTest {
|
|||
public class Publisher extends UntypedActor {
|
||||
|
||||
// activate the extension
|
||||
ActorRef mediator = DistributedPubSubExtension.get(getContext().system()).mediator();
|
||||
ActorRef mediator =
|
||||
DistributedPubSubExtension.get(getContext().system()).mediator();
|
||||
|
||||
public void onReceive(Object msg) {
|
||||
if (msg instanceof String) {
|
||||
String in = (String) msg;
|
||||
String out = in.toUpperCase();
|
||||
mediator.tell(new DistributedPubSubMediator.Publish("content", out), getSelf());
|
||||
mediator.tell(new DistributedPubSubMediator.Publish("content", out),
|
||||
getSelf());
|
||||
} else {
|
||||
unhandled(msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ public class ReliableProxyTest {
|
|||
return new UntypedActor() {
|
||||
|
||||
//#demo-transition
|
||||
final ActorRef proxy = getContext().actorOf(Props.create(ReliableProxy.class, target, Duration.create(100, "millis")));
|
||||
final ActorRef proxy = getContext().actorOf(Props.create(ReliableProxy.class, target,
|
||||
Duration.create(100, "millis")));
|
||||
ActorRef client = null;
|
||||
{
|
||||
proxy.tell(new FSM.SubscribeTransitionCallBack(getSelf()), getSelf());
|
||||
|
|
|
|||
|
|
@ -161,7 +161,8 @@ public class UntypedActorDocTest {
|
|||
//#system-actorOf
|
||||
// ActorSystem is a heavy object: create only one per application
|
||||
final ActorSystem system = ActorSystem.create("MySystem");
|
||||
final ActorRef myActor = system.actorOf(Props.create(MyUntypedActor.class), "myactor");
|
||||
final ActorRef myActor = system.actorOf(Props.create(MyUntypedActor.class),
|
||||
"myactor");
|
||||
//#system-actorOf
|
||||
try {
|
||||
new JavaTestKit(system) {
|
||||
|
|
@ -238,7 +239,8 @@ public class UntypedActorDocTest {
|
|||
//#creating-indirectly
|
||||
|
||||
final ActorRef myActor = getContext().actorOf(
|
||||
Props.create(DependencyInjector.class, applicationContext, "MyActor"), "myactor3");
|
||||
Props.create(DependencyInjector.class, applicationContext, "MyActor"),
|
||||
"myactor3");
|
||||
//#creating-indirectly
|
||||
new JavaTestKit(system) {
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ public class MyDurableMessageQueue extends DurableMessageQueueWithSerialization
|
|||
private final QueueStorage storage = new QueueStorage();
|
||||
// A real-world implementation would use configuration to set the last
|
||||
// three parameters below
|
||||
private final CircuitBreaker breaker = CircuitBreaker.create(system().scheduler(), 5,
|
||||
Duration.create(30, "seconds"), Duration.create(1, "minute"));
|
||||
private final CircuitBreaker breaker = CircuitBreaker.create(system().scheduler(),
|
||||
5, Duration.create(30, "seconds"), Duration.create(1, "minute"));
|
||||
|
||||
@Override
|
||||
public void enqueue(ActorRef receiver, final Envelope envelope) {
|
||||
|
|
|
|||
|
|
@ -566,7 +566,8 @@ public class FutureDocTest {
|
|||
return "foo";
|
||||
}
|
||||
}, ec);
|
||||
Future<String> result = Futures.firstCompletedOf(Arrays.<Future<String>>asList(future, delayed), ec);
|
||||
Future<String> result = Futures.firstCompletedOf(
|
||||
Arrays.<Future<String>>asList(future, delayed), ec);
|
||||
//#after
|
||||
Await.result(result, Duration.create(2, SECONDS));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ public class Processor extends UntypedActor {
|
|||
final PipelineStage<Context, Message, ByteString, Message, ByteString> stages =
|
||||
PipelineStage.sequence(
|
||||
// Java 7 can infer these types, Java 6 cannot
|
||||
PipelineStage.<Context, Message, Message, ByteString, Message, Message, ByteString> sequence( //
|
||||
PipelineStage.<Context, Message, Message, ByteString, Message, Message,
|
||||
ByteString> sequence( //
|
||||
new TickGenerator<Message, Message>(interval), //
|
||||
new MessageStage()), //
|
||||
new LengthFieldFrame(10000));
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ public class SslDocTest {
|
|||
final LoggingAdapter log = Logging
|
||||
.getLogger(getContext().system(), getSelf());
|
||||
|
||||
public SslClient(InetSocketAddress remote, SSLContext sslContext, ActorRef listener) {
|
||||
public SslClient(InetSocketAddress remote, SSLContext sslContext,
|
||||
ActorRef listener) {
|
||||
this.remote = remote;
|
||||
this.sslContext = sslContext;
|
||||
this.listener = listener;
|
||||
|
|
|
|||
|
|
@ -176,14 +176,17 @@ public class CustomRouterDocTest {
|
|||
//#crRoutingLogic
|
||||
return new CustomRoute() {
|
||||
@Override
|
||||
public scala.collection.immutable.Seq<Destination> destinationsFor(ActorRef sender, Object msg) {
|
||||
public scala.collection.immutable.Seq<Destination> destinationsFor(
|
||||
ActorRef sender, Object msg) {
|
||||
switch ((Message) msg) {
|
||||
case DemocratVote:
|
||||
case DemocratCountResult:
|
||||
return akka.japi.Util.immutableSingletonSeq(new Destination(sender, democratActor));
|
||||
return akka.japi.Util.immutableSingletonSeq(
|
||||
new Destination(sender, democratActor));
|
||||
case RepublicanVote:
|
||||
case RepublicanCountResult:
|
||||
return akka.japi.Util.immutableSingletonSeq(new Destination(sender, republicanActor));
|
||||
return akka.japi.Util.immutableSingletonSeq(
|
||||
new Destination(sender, republicanActor));
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown message: " + msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ public class SerializationDocTest {
|
|||
|
||||
// Deserialize
|
||||
// (beneath fromBinary)
|
||||
final ActorRef deserializedActorRef = extendedSystem.provider().resolveActorRef(identifier);
|
||||
final ActorRef deserializedActorRef = extendedSystem.provider().resolveActorRef(
|
||||
identifier);
|
||||
// Then just use the ActorRef
|
||||
//#actorref-serializer
|
||||
JavaTestKit.shutdownActorSystem(extendedSystem);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ public class ZeromqDocTest {
|
|||
|
||||
byte[] payload = new byte[0];
|
||||
//#pub-topic
|
||||
pubSocket.tell(ZMQMessage.withFrames(ByteString.fromString("foo.bar"), ByteString.fromArray(payload)), null);
|
||||
pubSocket.tell(ZMQMessage.withFrames(ByteString.fromString("foo.bar"),
|
||||
ByteString.fromArray(payload)), null);
|
||||
//#pub-topic
|
||||
|
||||
system.stop(subSocket);
|
||||
|
|
|
|||
|
|
@ -299,7 +299,8 @@ The following will not match::
|
|||
|
||||
Instead, use actorSelection followed by identify request, and watch the verified actor reference::
|
||||
|
||||
val selection = context.actorSelection("akka.tcp://actorSystemName@10.0.0.1:2552/user/actorName")
|
||||
val selection = context.actorSelection(
|
||||
"akka.tcp://actorSystemName@10.0.0.1:2552/user/actorName")
|
||||
selection ! Identify(None)
|
||||
var ref: ActorRef = _
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ import org.scalatest.{ BeforeAndAfterAll, WordSpec }
|
|||
import org.scalatest.matchers.MustMatchers
|
||||
import akka.testkit._
|
||||
//#typed-actor-impl
|
||||
import java.lang.String.{ valueOf ⇒ println } //Mr funny man avoids printing to stdout AND keeping docs alright
|
||||
//Mr funny man avoids printing to stdout AND keeping docs alright
|
||||
import java.lang.String.{ valueOf ⇒ println }
|
||||
import akka.actor.ActorRef
|
||||
|
||||
//#typed-actor-iface
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@ object DispatcherDocSpec {
|
|||
import akka.dispatch.RequiresMessageQueue
|
||||
import akka.dispatch.BoundedMessageQueueSemantics
|
||||
|
||||
class MyBoundedActor extends MyActor with RequiresMessageQueue[BoundedMessageQueueSemantics]
|
||||
class MyBoundedActor extends MyActor
|
||||
with RequiresMessageQueue[BoundedMessageQueueSemantics]
|
||||
//#required-mailbox-class
|
||||
|
||||
//#mailbox-implementation-example
|
||||
|
|
@ -301,7 +302,8 @@ class DispatcherDocSpec extends AkkaSpec(DispatcherDocSpec.config) {
|
|||
case x ⇒ log.info(x.toString)
|
||||
}
|
||||
}
|
||||
val a = system.actorOf(Props(classOf[Logger], this).withDispatcher("prio-dispatcher"))
|
||||
val a = system.actorOf(Props(classOf[Logger], this).withDispatcher(
|
||||
"prio-dispatcher"))
|
||||
|
||||
/*
|
||||
* Logs:
|
||||
|
|
|
|||
|
|
@ -182,7 +182,8 @@ package docs.serialization {
|
|||
}
|
||||
|
||||
def serializeTo(ref: ActorRef, remote: Address): String =
|
||||
ref.path.toSerializationFormatWithAddress(ExternalAddress(extendedSystem).addressFor(remote))
|
||||
ref.path.toSerializationFormatWithAddress(ExternalAddress(extendedSystem).
|
||||
addressFor(remote))
|
||||
//#external-address
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +198,8 @@ package docs.serialization {
|
|||
}
|
||||
|
||||
def serializeAkkaDefault(ref: ActorRef): String =
|
||||
ref.path.toSerializationFormatWithAddress(ExternalAddress(theActorSystem).addressForAkka)
|
||||
ref.path.toSerializationFormatWithAddress(ExternalAddress(theActorSystem).
|
||||
addressForAkka)
|
||||
//#external-address-default
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ object TestKitUsageSpec {
|
|||
* like to test that the interesting value is received and that you cant
|
||||
* be bothered with the rest
|
||||
*/
|
||||
class SequencingActor(next: ActorRef, head: immutable.Seq[String], tail: immutable.Seq[String])
|
||||
extends Actor {
|
||||
class SequencingActor(next: ActorRef, head: immutable.Seq[String],
|
||||
tail: immutable.Seq[String]) extends Actor {
|
||||
def receive = {
|
||||
case msg ⇒ {
|
||||
head foreach { next ! _ }
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ object ZeromqDocSpec {
|
|||
def receive = {
|
||||
// the first frame is the topic, second is the message
|
||||
case m: ZMQMessage if m.frames(0).utf8String == "health.heap" ⇒
|
||||
val Heap(timestamp, used, max) = ser.deserialize(m.frames(1).toArray, classOf[Heap]).get
|
||||
val Heap(timestamp, used, max) =
|
||||
ser.deserialize(m.frames(1).toArray, classOf[Heap]).get
|
||||
if ((used.toDouble / max) > 0.9) count += 1
|
||||
else count = 0
|
||||
if (count > 10) log.warning("Need more memory, using {} %",
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ akka {
|
|||
mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox"
|
||||
}
|
||||
|
||||
# Controls the backoff interval after a refused write is reattempted. (Transports may
|
||||
# refuse writes if their internal buffer is full)
|
||||
# Controls the backoff interval after a refused write is reattempted.
|
||||
# (Transports may refuse writes if their internal buffer is full)
|
||||
backoff-interval = 0.01 s
|
||||
|
||||
# Acknowledgment timeout of management commands sent to the transport stack.
|
||||
|
|
@ -135,7 +135,8 @@ akka {
|
|||
### Failure detection and recovery
|
||||
|
||||
# Settings for the Phi accrual failure detector (http://ddg.jaist.ac.jp/pub/HDY+04.pdf
|
||||
# [Hayashibara et al]) used by the remoting subsystem to detect failed connections.
|
||||
# [Hayashibara et al]) used by the remoting subsystem to detect failed
|
||||
# connections.
|
||||
transport-failure-detector {
|
||||
|
||||
# FQCN of the failure detector implementation.
|
||||
|
|
@ -359,13 +360,13 @@ akka {
|
|||
|
||||
# Sets the size of the connection backlog
|
||||
backlog = 4096
|
||||
|
||||
|
||||
# Enables the TCP_NODELAY flag, i.e. disables Nagle’s algorithm
|
||||
tcp-nodelay = on
|
||||
|
||||
|
||||
# Enables TCP Keepalive, subject to the O/S kernel’s configuration
|
||||
tcp-keepalive = on
|
||||
|
||||
|
||||
# Enables SO_REUSEADDR, which determines when an ActorSystem can open
|
||||
# the specified listen port (the meaning differs between *nix and Windows)
|
||||
tcp-reuse-addr = on
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ public class FactorialFrontendMain {
|
|||
Cluster.get(system).registerOnMemberUp(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
system.actorOf(Props.create(FactorialFrontend.class, upToN, true), "factorialFrontend");
|
||||
system.actorOf(Props.create(FactorialFrontend.class, upToN, true),
|
||||
"factorialFrontend");
|
||||
}
|
||||
});
|
||||
//#registerOnUp
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@ abstract class StatsSampleSingleMasterSpec extends MultiNodeSpec(StatsSampleSing
|
|||
// service and worker nodes might not be up yet
|
||||
awaitAssert {
|
||||
facade ! StatsJob("this is the text that will be analyzed")
|
||||
expectMsgType[StatsResult](1.second).meanWordLength must be(3.875 plusOrMinus 0.001)
|
||||
expectMsgType[StatsResult](1.second).meanWordLength must be(
|
||||
3.875 plusOrMinus 0.001)
|
||||
}
|
||||
|
||||
testConductor.enter("done")
|
||||
|
|
|
|||
|
|
@ -120,7 +120,8 @@ abstract class StatsSampleSpec extends MultiNodeSpec(StatsSampleSpecConfig)
|
|||
// first attempts might fail because worker actors not started yet
|
||||
awaitAssert {
|
||||
service ! StatsJob("this is the text that will be analyzed")
|
||||
expectMsgType[StatsResult](1.second).meanWordLength must be(3.875 plusOrMinus 0.001)
|
||||
expectMsgType[StatsResult](1.second).meanWordLength must be(
|
||||
3.875 plusOrMinus 0.001)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,10 @@ public class JCreationApplication implements Bootable {
|
|||
public JCreationApplication() {
|
||||
system = ActorSystem.create("CreationApplication", ConfigFactory.load()
|
||||
.getConfig("remotecreation"));
|
||||
final ActorRef remoteActor = system.actorOf(Props.create(JAdvancedCalculatorActor.class),
|
||||
"advancedCalculator");
|
||||
actor = system.actorOf(Props.create(JCreationActor.class, remoteActor), "creationActor");
|
||||
final ActorRef remoteActor = system.actorOf(Props.create(
|
||||
JAdvancedCalculatorActor.class), "advancedCalculator");
|
||||
actor = system.actorOf(Props.create(JCreationActor.class, remoteActor),
|
||||
"creationActor");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,11 +42,13 @@ public class JLookupActor extends UntypedActor {
|
|||
|
||||
} else if (message instanceof Op.AddResult) {
|
||||
Op.AddResult result = (Op.AddResult) message;
|
||||
System.out.printf("Add result: %d + %d = %d\n", result.getN1(), result.getN2(), result.getResult());
|
||||
System.out.printf("Add result: %d + %d = %d\n", result.getN1(),
|
||||
result.getN2(), result.getResult());
|
||||
|
||||
} else if (message instanceof Op.SubtractResult) {
|
||||
Op.SubtractResult result = (Op.SubtractResult) message;
|
||||
System.out.printf("Sub result: %d - %d = %d\n", result.getN1(), result.getN2(), result.getResult());
|
||||
System.out.printf("Sub result: %d - %d = %d\n", result.getN1(),
|
||||
result.getN2(), result.getResult());
|
||||
|
||||
} else {
|
||||
unhandled(message);
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@ public class JLookupApplication implements Bootable {
|
|||
private ActorRef actor;
|
||||
|
||||
public JLookupApplication() {
|
||||
system = ActorSystem.create("LookupApplication", ConfigFactory.load().getConfig("remotelookup"));
|
||||
final String path = "akka.tcp://CalculatorApplication@127.0.0.1:2552/user/simpleCalculator";
|
||||
system = ActorSystem.create("LookupApplication", ConfigFactory.load().getConfig(
|
||||
"remotelookup"));
|
||||
final String path =
|
||||
"akka.tcp://CalculatorApplication@127.0.0.1:2552/user/simpleCalculator";
|
||||
actor = system.actorOf(Props.create(JLookupActor.class, path), "lookupActor");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ public class JSimpleCalculatorActor extends UntypedActor {
|
|||
|
||||
} else if (message instanceof Op.Subtract) {
|
||||
Op.Subtract subtract = (Op.Subtract) message;
|
||||
System.out.println("Calculating " + subtract.getN1() + " - " + subtract.getN2());
|
||||
System.out.println("Calculating " + subtract.getN1() + " - " +
|
||||
subtract.getN2());
|
||||
getSender().tell(new Op.SubtractResult(
|
||||
subtract.getN1(), subtract.getN2(), subtract.getN1() - subtract.getN2()),
|
||||
getSelf());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue