aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/akka/ActorSystemAspect.scala
blob: ce00d973ad3e01d2e19979bcc6a2221bac18da0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package akka

import org.aspectj.lang.annotation._
import akka.actor.ActorSystemImpl
import com.typesafe.config.Config

@Aspect
@DeclarePrecedence("ActorSystemAspect")
class ActorSystemAspect {

  var currentActorSystem:ActorSystemImpl = _

  @Pointcut("execution(akka.actor.ActorSystemImpl.new(..)) && !within(ActorSystemAspect)")
  protected def actorSystem():Unit = {}

  @Before("actorSystem() && this(system) && args(name, config, classLoader)")
  def collectActorSystem(system: ActorSystemImpl, name: String, config: Config, classLoader: ClassLoader) { currentActorSystem = system }
}