Simple JMX

Simple JMX package for Java that helps publishing of objects using JMX.

Лицензия

Лицензия

Группа

Группа

com.j256.simplejmx
Идентификатор

Идентификатор

simplejmx
Последняя версия

Последняя версия

1.19
Дата

Дата

Тип

Тип

jar
Описание

Описание

Simple JMX
Simple JMX package for Java that helps publishing of objects using JMX.
Ссылка на сайт

Ссылка на сайт

https://256stuff.com/sources/simplejmx/
Система контроля версий

Система контроля версий

https://github.com/j256/simplejmx

Скачать simplejmx

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.j256.simplejmx/simplejmx/ -->
<dependency>
    <groupId>com.j256.simplejmx</groupId>
    <artifactId>simplejmx</artifactId>
    <version>1.19</version>
</dependency>
// https://jarcasting.com/artifacts/com.j256.simplejmx/simplejmx/
implementation 'com.j256.simplejmx:simplejmx:1.19'
// https://jarcasting.com/artifacts/com.j256.simplejmx/simplejmx/
implementation ("com.j256.simplejmx:simplejmx:1.19")
'com.j256.simplejmx:simplejmx:jar:1.19'
<dependency org="com.j256.simplejmx" name="simplejmx" rev="1.19">
  <artifact name="simplejmx" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.j256.simplejmx', module='simplejmx', version='1.19')
)
libraryDependencies += "com.j256.simplejmx" % "simplejmx" % "1.19"
[com.j256.simplejmx/simplejmx "1.19"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.springframework : spring-beans Необязательный jar 3.1.0.RELEASE
org.springframework : spring-context Необязательный jar 3.1.0.RELEASE
org.eclipse.jetty : jetty-server Необязательный jar 8.2.0.v20160908

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13.2
org.easymock : easymock jar 3.4
net.sourceforge.htmlunit : htmlunit jar 2.13

Модули Проекта

Данный проект не имеет модулей.

Simple Java JMX

This package provides some Java classes to help with the publishing of objects using JMX.

Enjoy. Gray Watson

Little Sample Program

Here's a little sample program to help you get started.

Publishing JMX Beans over HTTP for Web Browser

SimpleJMX also contains a simple web-server handler that uses Jetty so that you can access JMX information from a web browser or other web client using the JmxWebServer class. To use this class you need to provide a Jetty version in your dependency list or classpath. You just need to add the following code to your application startup.

// start a web server for exposing jmx beans listing on port 8080
JmxWebServer jmxWebServer = new JmxWebServer(8080);
jmxWebServer.start();

For more details, see the web server sample program.

Sample Jmx Code

First we create a server either as a wrapper around the default mbean server running in the JVM or one that listens on it's own port.

// create a new JMX server listening on a specific port
JmxServer jmxServer = new JmxServer(JMX_PORT);
// NOTE: you could also use the platform mbean server:
// JmxServer jmxServer = new JmxServer(ManagementFactory.getPlatformMBeanServer());

// start the server
jmxServer.start();

// create the object we will be exposing with JMX
RuntimeCounter counter = new RuntimeCounter();
// register our object
jmxServer.register(counter);
...
// shutdown our server
jmxServer.stop();
...

Here's the class we are publishing via the server. The class is annotated with @JmxResource to define the bean name. The fields and get/set methods are annotated to show attributes (@JmxAttributeField, @JmxAttributeMethod). Other methods can be annotated with @JmxOperation to expose them as operations.

@JmxResource(domainName = "j256")
public class RuntimeCounter {
	private long startMillis = System.currentTimeMillis();
	
	// we can annotate fields directly to be published, isReadible defaults to true
	@JmxAttributeField(description = "Show runtime in seconds", isWritable = true)
	private boolean showSeconds;
	
	// we can annotate getter methods
	@JmxAttributeMethod(description = "Run time in seconds or milliseconds")
	public long getRunTime() {
		long diffMillis = System.currentTimeMillis() - startMillis;
		return diffMillis / (showSeconds ? 1000 : 1);
	}
	
	// this is an operation that shows up in the operations tab in jconsole.
	@JmxOperation(description = "Reset our start time to the current millis")
	public String resetStartTime() {
		startMillis = System.currentTimeMillis();
		return "Timer has been reset to current millis";
	}
}

Maven Configuration

  • Maven packages are published via Maven Central
<dependency>
	<groupId>com.j256.simplejmx</groupId>
	<artifactId>simplejmx</artifactId>
	<version>1.19</version>
</dependency>

ChangeLog Release Notes

See the ChangeLog.txt file.

Версии библиотеки

Версия
1.19
1.18
1.17
1.16
1.15
1.14
1.13
1.12
1.11
1.10
1.9
1.8
1.7
1.6
1.5
1.4
1.3
1.2
1.1
1.0
0.6
0.5