Skip to content
Permalink
Browse files

Reviewing chenges for setting up jolokia

  • Loading branch information...
atooni committed Jun 3, 2019
1 parent a20e566 commit c78c933540992eb09162d1b656a53033aceb262d
@@ -1,8 +1,9 @@
package blended.jetty.boot.internal

import javax.net.ssl.SSLContext

import domino.DominoActivator
import javax.management.{MBeanServer, ObjectName}
import org.eclipse.jetty.jmx.MBeanContainer
import org.eclipse.jetty.osgi.boot.JettyBootstrapActivator

object JettyActivator {
@@ -13,20 +14,28 @@ object JettyActivator {

class JettyActivator extends DominoActivator {

private val connectorName : ObjectName = new ObjectName("org.eclipse.jetty", "type", "connector")

whenBundleActive {
whenAdvancedServicePresent[SSLContext]("(type=server)") { sslCtxt =>
whenServicePresent[MBeanServer]{ mbeanServer =>
whenAdvancedServicePresent[SSLContext]("(type=server)") { sslCtxt =>

JettyActivator.sslContext = Some(sslCtxt)
onStop {
JettyActivator.sslContext = None
}
JettyActivator.sslContext = Some(sslCtxt)
onStop {
JettyActivator.sslContext = None
}

val jettyActivator = new JettyBootstrapActivator()

val jettyActivator = new JettyBootstrapActivator()
jettyActivator.start(bundleContext)

jettyActivator.start(bundleContext)
val mbeanContainer = new MBeanContainer(mbeanServer)
mbeanServer.registerMBean(mbeanContainer, connectorName)

onStop {
jettyActivator.stop(bundleContext)
onStop {
jettyActivator.stop(bundleContext)
mbeanServer.unregisterMBean(connectorName)
}
}
}
}
@@ -1,12 +1,12 @@
package blended.mgmt.service.jmx.internal

import javax.management.MBeanServer

import akka.actor.{Cancellable, Props}
import akka.actor.Props
import blended.akka.{OSGIActor, OSGIActorConfig}

import javax.management.MBeanServer
import scala.concurrent.duration._

import scala.concurrent.ExecutionContext

object ServiceJmxCollector {
def props(cfg: OSGIActorConfig, svcConfig: ServiceJmxConfig, server : MBeanServer) =
Props(new ServiceJmxCollector(cfg, svcConfig, server))
@@ -16,26 +16,20 @@ class ServiceJmxCollector(cfg: OSGIActorConfig, svcConfig : ServiceJmxConfig, se

case object Tick

implicit val eCtxt = cfg.system.dispatcher
private implicit val eCtxt : ExecutionContext = cfg.system.dispatcher

val analyser = new ServiceJmxAnalyser(server, svcConfig)

var timer : Option[Cancellable] = None

override def preStart(): Unit = {
super.preStart()
timer = Some(cfg.system.scheduler.schedule(10.millis, svcConfig.interval.seconds, self, Tick))
}

override def postStop(): Unit = {
timer.foreach(_.cancel())
super.postStop()
self ! Tick
}

override def receive: Receive = {
case Tick =>
log.debug("Refreshing Service Information from JMX")
analyser.analyse().foreach(info => cfg.system.eventStream.publish(info))
context.system.scheduler.scheduleOnce(svcConfig.interval.seconds, self, Tick)
}

}
@@ -181,10 +181,7 @@ lazy val root = {
unidocProjectFilter.in(ScalaUnidoc, unidoc) := inAnyProject -- inProjects(jsProjects:_*)
)
.settings(global)
// .settings(CommonSettings())
// .settings(PublishConfig.doPublish)
.enablePlugins(ScalaUnidocPlugin, JBake)
.settings(RootSettings(BlendedDocsJs.project))
// .settings(ExportDependencies.settings)
.aggregate((jvmProjects ++ jsProjects ++ Seq[ProjectReference](BlendedDependencies.project)):_*)
}
@@ -1,5 +1,6 @@
{
"dependencies": {
"@babel/runtime": "^7.4.5",
"mermaid": "^8.0.0-rc.8",
"mermaid.cli": "^0.5.1",
"popper.js": "^1.14.4"
@@ -13,8 +13,8 @@ trait Dependencies {
val akkaHttpVersion = "10.1.7"
val camelVersion = "2.19.5"
val dominoVersion = "1.1.3"
val jettyVersion = "9.4.8.v20171121"
val jolokiaVersion = "1.5.0"
val jettyVersion = "9.4.18.v20190429"
val jolokiaVersion = "1.6.1"
val microJsonVersion = "1.4"
val parboiledVersion = "1.1.6"
val prickleVersion = "1.1.14"
@@ -146,7 +146,7 @@ trait Dependencies {
val typesafeConfig = "com.typesafe" % "config" % "1.3.3"
// FIXME: Rename to typesafeSslConfigCore
val typesafeConfigSSL = "com.typesafe" %% "ssl-config-core" % "0.3.6"

}

object Dependencies extends Dependencies

0 comments on commit c78c933

Please sign in to comment.
You can’t perform that action at this time.