actor

Writing applications with Scala actors in practice II [closed]

ぃ、小莉子 提交于 2019-12-03 09:29:41
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Because my first question was so long, I'm asking this as a separate question. It's another one about the architecture of an actor-based application. Keeping track of message paths through an Application Let's take a piece of Java code: public void deleteTrades(User user, Date date) { PermissionSet ps = permissionService.findPermissions(user) if (ps.hasPermission("delete")) { Set<Trade> ts = peristence.findTrades(date);

Spray-can NoClassDefFoundError

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new to spray, i can't get it to work... :/ My build.sbt: val apacheDeps = Seq( "commons-validator" % "commons-validator" % "1.4.1" ) val sprayAndAkkaDeps = { val sprayV = "1.3.3" Seq( "io.spray" %% "spray-can" % sprayV, "io.spray" %% "spray-routing" % sprayV, "io.spray" %% "spray-testkit" % sprayV % "test", "com.typesafe.akka" %% "akka-actor" % "2.3.9" ) } name := "myApp" version := "1.0.0" scalaVersion := "2.11.6" libraryDependencies ++= Seq( "org.mongodb" %% "casbah" % "2.8.1", "ch.qos.logback" % "logback-classic" % "1.1.2", "org.scala

Akka Design Principals

假如想象 提交于 2019-12-03 08:34:14
Whilst working on a fairly large Akka application, I have come across a very simple structure when working with normal methods and non Akka classes but which are actually quite difficult to nail when working with Akka which is why I have come here to ask what you recommend to be the best way to solve this issue. So the issue is this, I have one parent actor, let's call him "Connector", Connector has behavior describing what it should do when it receives a ConnectCommand instance. First it submit a form using an HttpClient, then it goes to a couple of URLs to check for some session parameters

time-based simulation with actors model

筅森魡賤 提交于 2019-12-03 08:05:58
we have a single threaded application that simulates the interaction of a hundred of thousands of objects over time with the shared memory model. obviously, it suffers from its inability to scale over multi CPU hardware. after reading a little about agent based modeling and functional programming/actor model I was considering a rewrite with the message-passing paradigm. the idea is very simple - each object will be an actor and their interactions will be messages so that the simulation could happen in parallel. given a configuration of objects at a certain time - its future consequences can be

Waiting for multiple results in Akka

时光毁灭记忆、已成空白 提交于 2019-12-03 07:55:45
What is the proper way to wait for the result of multiple actors in Akka? The Principles of Reactive Programming Coursera course had an exercise with a replicated key-value store. Without going into the details of the assignment, it required waiting on the acknowledgement of multiple actors before it could indicate the replication was complete. I implemented the assignment using a mutable map containing the outstanding requests, but I felt the solution had a 'bad smell'. I hoped there was a better way to implement what seems like a common scenario. In an attempt to uphold the classes' honor

Asynchronous http requests using Netty and Scala actors

坚强是说给别人听的谎言 提交于 2019-12-03 07:45:56
Asynchronous http requests using Netty and Scala actors Hey hope someone can give me a hand with this. I am trying to use the Scala Actors and Netty.io libraries to get make asynchronous http requests. (Yes I know Scala actors are being deprecated but this is a learning exercise for me) I have written an actor HttpRequestActor that accepts a message in the form of a case class RequestPage(uri:URI). When it receives the message it creates the necessary Netty objects need to make a http request, I have based most of the code from the [ HttpSnoopClient ] (http://static.netty.io/3.5/xref/org/jboss

How would you explain actors to a non-programmer? [closed]

北城余情 提交于 2019-12-03 07:40:25
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . Well, the title's pretty much it: if I sat a non-techie/my mum/twelve-year old boy/cocker spaniel in front of you and asked you to explain actors to them, where would you start? I ask because my master's project involves them to a pretty large degree, and every other day someone

How are akka actors implemented on underlying threads?

只谈情不闲聊 提交于 2019-12-03 07:22:23
问题 Given an execution context and a thread pool, how are akka/scala actors scheduled/implemented on that? 回答1: I was confused with this topic for a long time. I assumed that there is some relation between threads and actors. For each actor there is a thread that hosts it, so I was thinking. Probably there are several actors for each thread that works in cooperative multitasking mode. Documentation is focused on usage and cover internal architecture lightly. You just should extend Actor class and

How do I best share behavior among Akka actors?

。_饼干妹妹 提交于 2019-12-03 06:54:02
问题 I have two Akka actors that respond to some messages in the same way, but others in a different way. They both respond to the same set of messages. Wondering how to design my two actors with their receive methods, via inheritance, composure, etc? I tried chaining together partial functions from other traits with "orElse", which unfortunately exposes the class to its trait's functionality, plus I wasn't sure how the trait's receive could easily access the actor context. A drop-in, modularized

Which ThreadPool in Java should I use?

寵の児 提交于 2019-12-03 06:48:06
There are a huge amount of tasks. Each task is belong to a single group. The requirement is each group of tasks should executed serially just like executed in a single thread and the throughput should be maximized in a multi-core (or multi-cpu) environment. Note: there are also a huge amount of groups that is proportional to the number of tasks. The naive solution is using ThreadPoolExecutor and synchronize (or lock). However, threads would block each other and the throughput is not maximized. Any better idea? Or is there exist a third party library satisfy the requirement? A simple approach