blob: 3dfc9c6aa135f174da06fadc41ad3e3647df0f5c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package akka
import org.aspectj.lang.annotation.{Pointcut, Before, Aspect}
import java.util.concurrent.{TimeUnit, Executors}
@Aspect
class MailboxAspect {
@Pointcut("execution(akka.dispatch.Mailbox.new(..))")
protected def mailboxMonitor:Unit = {}
@Before("mailboxMonitor() && this(mb)")
def before(mb: akka.dispatch.Mailbox) : Unit = {
val scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new Runnable {
def run() {
println("Mailbox: " + mb.actor.self.path)
println("NOM: " + mb.numberOfMessages)
println("Messages: " + mb.hasMessages)
print("Dispatcher throughput: " + mb.dispatcher.throughput)
println(mb.dispatcher.id)
}
}, 6, 4, TimeUnit.SECONDS)
}
}
|