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