Created
July 17, 2016 16:05
-
-
Save HDBandit/039be2fe106b3b38947b30b779ea6601 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ActorWithJMXSupport extends Actor { | |
val mBeanServer = ManagementFactory.getPlatformMBeanServer(); | |
val objName = new ObjectName("hdbandit", { | |
import scala.collection.JavaConverters._ | |
new java.util.Hashtable( | |
Map( | |
"name" -> self.path.toStringWithoutAddress, | |
"type" -> getMXTypeName | |
).asJava | |
) | |
}) | |
def getMXTypeName : String | |
override def preStart() = mBeanServer.registerMBean(this, objName) | |
override def postStop() = mBeanServer.unregisterMBean(objName) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment