Scala 2.12
import java.lang.management.{ManagementFactory, PlatformManagedObject}
import javax.management.{MBeanInfo, ObjectName}
import scala.collection.JavaConverters._
val mbeanInterfaces: Seq[Class[_ <: PlatformManagedObject]] = ManagementFactory.getPlatformManagementInterfaces.asScala.toSeq
val mbeanObjects: Seq[_ <: PlatformManagedObject] = mbeanInterfaces.flatMap(ManagementFactory.getPlatformMXBeans(_).asScala.toSeq)
val mbeanObjectNames: Seq[ObjectName] = mbeanObjects.map(_.getObjectName)
val mbeanInfos: Seq[MBeanInfo] = mbeanObjectNames.map(ManagementFactory.getPlatformMBeanServer.getMBeanInfo(_))
MBeanInfo
とObjectName
をつかってMBeanServer
(ManagementFactory.getPlatformMBeanServer
)経由で情報を取得する。