remove app argument from Dispatchers
(cascading into all dispatchers, mailboxes, other stuff; had to move deadLetter stuff to ActorSystem again and split its initialization due to cyclic dependency)
This commit is contained in:
parent
79daccdce1
commit
f2bf27b4de
20 changed files with 180 additions and 130 deletions
|
|
@ -9,6 +9,8 @@ import java.util.concurrent.atomic.AtomicReference
|
|||
import java.util.concurrent.{ TimeUnit, ExecutorService, RejectedExecutionException, ConcurrentLinkedQueue }
|
||||
import akka.actor.{ ActorCell, ActorKilledException }
|
||||
import akka.actor.ActorSystem
|
||||
import akka.event.EventStream
|
||||
import akka.actor.Scheduler
|
||||
|
||||
/**
|
||||
* Default settings are:
|
||||
|
|
@ -64,14 +66,16 @@ import akka.actor.ActorSystem
|
|||
* Larger values (or zero or negative) increase throughput, smaller values increase fairness
|
||||
*/
|
||||
class Dispatcher(
|
||||
_app: ActorSystem,
|
||||
_deadLetterMailbox: Mailbox,
|
||||
_eventStream: EventStream,
|
||||
_scheduler: Scheduler,
|
||||
val name: String,
|
||||
val throughput: Int,
|
||||
val throughputDeadlineTime: Int,
|
||||
val mailboxType: MailboxType,
|
||||
executorServiceFactoryProvider: ExecutorServiceFactoryProvider,
|
||||
val timeoutMs: Long)
|
||||
extends MessageDispatcher(_app) {
|
||||
extends MessageDispatcher(_deadLetterMailbox, _eventStream, _scheduler) {
|
||||
|
||||
protected[akka] val executorServiceFactory = executorServiceFactoryProvider.createExecutorServiceFactory(name)
|
||||
protected[akka] val executorService = new AtomicReference[ExecutorService](new LazyExecutorServiceWrapper(executorServiceFactory.createExecutorService))
|
||||
|
|
@ -93,7 +97,7 @@ class Dispatcher(
|
|||
executorService.get() execute invocation
|
||||
} catch {
|
||||
case e: RejectedExecutionException ⇒
|
||||
app.eventStream.publish(Warning(this, e.toString))
|
||||
eventStream.publish(Warning(this, e.toString))
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
|
@ -120,7 +124,7 @@ class Dispatcher(
|
|||
} catch {
|
||||
case e: RejectedExecutionException ⇒
|
||||
try {
|
||||
app.eventStream.publish(Warning(this, e.toString))
|
||||
eventStream.publish(Warning(this, e.toString))
|
||||
} finally {
|
||||
mbox.setAsIdle()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue