diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2015-01-26 19:50:33 +0100 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2015-01-26 19:50:33 +0100 |
commit | f072a5d0818254cdd2f5941c5ef9d462f8dcdb2b (patch) | |
tree | 01c961f613e52ea17b2c9fb1229fb0f4d7c5a692 /kamon-core/src/main | |
parent | 485abe569d23bccf2d263c82b43e59464dc7e834 (diff) | |
download | Kamon-f072a5d0818254cdd2f5941c5ef9d462f8dcdb2b.tar.gz Kamon-f072a5d0818254cdd2f5941c5ef9d462f8dcdb2b.tar.bz2 Kamon-f072a5d0818254cdd2f5941c5ef9d462f8dcdb2b.zip |
! core: ensure that the subscriptions dispatcher is correctly started
Diffstat (limited to 'kamon-core/src/main')
-rw-r--r-- | kamon-core/src/main/scala/kamon/ModuleSupervisor.scala | 3 | ||||
-rw-r--r-- | kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/kamon-core/src/main/scala/kamon/ModuleSupervisor.scala b/kamon-core/src/main/scala/kamon/ModuleSupervisor.scala index 99d87719..7e82f80a 100644 --- a/kamon-core/src/main/scala/kamon/ModuleSupervisor.scala +++ b/kamon-core/src/main/scala/kamon/ModuleSupervisor.scala @@ -21,7 +21,7 @@ trait ModuleSupervisorExtension extends actor.Extension { class ModuleSupervisorExtensionImpl(system: ExtendedActorSystem) extends ModuleSupervisorExtension { import system.dispatcher - private lazy val supervisor = system.actorOf(Props[ModuleSupervisor], "kamon") + private val supervisor = system.actorOf(Props[ModuleSupervisor], "kamon") def createModule(name: String, props: Props): Future[ActorRef] = Future {} flatMap { _: Unit ⇒ val modulePromise = Promise[ActorRef]() @@ -37,6 +37,7 @@ class ModuleSupervisor extends Actor with ActorLogging { } def createChildModule(name: String, props: Props, childPromise: Promise[ActorRef]): Unit = { + context.child(name).map { alreadyAvailableModule ⇒ log.warning("Received a request to create module [{}] but the module is already available, returning the existent one.") childPromise.complete(Success(alreadyAvailableModule)) diff --git a/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala b/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala index b738eeb9..0b7fc7f2 100644 --- a/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala +++ b/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala @@ -70,7 +70,7 @@ class MetricsExtensionImpl(system: ExtendedActorSystem) extends MetricsExtension private val _trackedEntities = TrieMap.empty[Entity, EntityRecorder] private val _collectionContext = buildDefaultCollectionContext private val _metricsCollectionDispatcher = system.dispatchers.lookup(settings.metricCollectionDispatcher) - private val _subscriptions = ModuleSupervisor.get(system).createModule("subscriptions-dispatcher", + private lazy val _subscriptions = ModuleSupervisor.get(system).createModule("subscriptions-dispatcher", SubscriptionsDispatcher.props(settings.tickInterval, collectSnapshots).withDispatcher(settings.metricCollectionDispatcher)) def shouldTrack(entity: Entity): Boolean = |