Skip to content

Commit

Permalink
feat(deploy): enable JVMList MBean in hawtio-default for Connect disc…
Browse files Browse the repository at this point in the history
…overy support
  • Loading branch information
tadayosi committed Nov 14, 2023
1 parent 9a5e12d commit 245a4fc
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
2 changes: 1 addition & 1 deletion console/craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
},
}),
new MonacoWebpackPlugin({
languages: ['xml', 'json', 'html', 'plaintext'],
languages: ['xml', 'json', 'plaintext'],
globalAPI: true,
}),
],
Expand Down
12 changes: 10 additions & 2 deletions deploy/hawtio-default/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
-->
<type>war</type>
</dependency>
<dependency>
<groupId>io.hawt</groupId>
<artifactId>hawtio-system</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>

<!-- let's mark dependencies from the WAR as provided to avoid jetty:run adding duplicates -->
<dependency>
Expand All @@ -41,14 +47,16 @@
</dependency>

<!-- now let's add some components -->
<!-- Connect plugin -->
<dependency>
<groupId>io.hawt</groupId>
<artifactId>hawtio-log</artifactId>
<artifactId>hawtio-local-jvm-mbean</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Log plugin -->
<dependency>
<groupId>io.hawt</groupId>
<artifactId>hawtio-local-jvm-mbean</artifactId>
<artifactId>hawtio-log</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.hawt;

import jakarta.servlet.ServletContextEvent;

import io.hawt.HawtioContextListener;
import io.hawt.jvm.local.JVMList;

public class HawtioDefaultContextListener extends HawtioContextListener {
private final JVMList jvmList;

public HawtioDefaultContextListener() {
super();
this.jvmList = new JVMList();
}

public void contextInitialized(ServletContextEvent servletContextEvent) {
super.contextInitialized(servletContextEvent);
try {
jvmList.init();
} catch (Exception e) {
throw createServletException(e);
}
}

public void contextDestroyed(ServletContextEvent servletContextEvent) {
super.contextDestroyed(servletContextEvent);
try {
jvmList.destroy();
} catch (Exception e) {
throw createServletException(e);
}
}
}
2 changes: 1 addition & 1 deletion deploy/hawtio-default/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
</mime-mapping>

<listener>
<listener-class>io.hawt.HawtioContextListener</listener-class>
<listener-class>io.hawt.HawtioDefaultContextListener</listener-class>
</listener>

<error-page>
Expand Down

0 comments on commit 245a4fc

Please sign in to comment.