{"id":17241776,"url":"https://github.com/j256/simplejmx","last_synced_at":"2025-04-09T23:18:38.995Z","repository":{"id":7320103,"uuid":"8638780","full_name":"j256/simplejmx","owner":"j256","description":"Simple JMX Java Library to help with the publishing of objects using JMX and the web","archived":false,"fork":false,"pushed_at":"2023-06-13T23:10:32.000Z","size":2313,"stargazers_count":93,"open_issues_count":2,"forks_count":22,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-09T23:18:34.258Z","etag":null,"topics":["annotations","java","jmx","web","web-server"],"latest_commit_sha":null,"homepage":"http://256stuff.com/sources/simplejmx/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j256.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"j256","patreon":"j256"}},"created_at":"2013-03-07T23:17:12.000Z","updated_at":"2025-03-23T04:19:18.000Z","dependencies_parsed_at":"2024-10-27T01:00:11.491Z","dependency_job_id":null,"html_url":"https://github.com/j256/simplejmx","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j256%2Fsimplejmx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j256%2Fsimplejmx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j256%2Fsimplejmx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j256%2Fsimplejmx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j256","download_url":"https://codeload.github.com/j256/simplejmx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125592,"owners_count":21051771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotations","java","jmx","web","web-server"],"created_at":"2024-10-15T06:11:17.703Z","updated_at":"2025-04-09T23:18:38.961Z","avatar_url":"https://github.com/j256.png","language":"Java","readme":"Simple Java JMX\n===============\n\nThis package provides some Java classes to help with the publishing of objects using JMX.\n\n* For more information, visit the [SimpleJMX home page](http://256stuff.com/sources/simplejmx/).\n* Online documentation can be found on the home page.  Here are the [SimpleJMX Javadocs](http://256stuff.com/sources/simplejmx/javadoc/simplejmx/).\n* Code available from the [git repository](https://github.com/j256/simplejmx).  [![CircleCI](https://circleci.com/gh/j256/simplejmx.svg?style=svg)](https://circleci.com/gh/j256/simplejmx) [![CodeCov](https://img.shields.io/codecov/c/github/j256/simplejmx.svg)](https://codecov.io/github/j256/simplejmx/)\n* Maven packages are published via [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.j256.simplejmx/simplejmx/badge.svg?style=flat-square)](https://mvnrepository.com/artifact/com.j256.simplejmx/simplejmx/latest) [![javadoc](https://javadoc.io/badge2/com.j256.simplejmx/simplejmx/javadoc.svg)](https://javadoc.io/doc/com.j256.simplejmx/simplejmx)\n\nEnjoy.  Gray Watson\n\n## Little Sample Program\n\nHere's a [little sample program](http://256stuff.com/sources/simplejmx/docs/example-simple) to help you get started.\n\n## Publishing JMX Beans over HTTP for Web Browser\n\nSimpleJMX also contains a simple web-server handler that uses Jetty so that you can access JMX information from a web\nbrowser or other web client using the ```JmxWebServer``` class.  To use this class you need to provide a Jetty\nversion in your dependency list or classpath.  You just need to add the following code to your application startup.\n\n\t// start a web server for exposing jmx beans listing on port 8080\n\tJmxWebServer jmxWebServer = new JmxWebServer(8080);\n\tjmxWebServer.start();\n\nFor more details, see the [web server sample program](http://256stuff.com/sources/simplejmx/docs/example-web).\n\n## Sample Jmx Code\n\nFirst we create a server either as a wrapper around the default mbean server running in the JVM or one that listens\non it's own port.\n\n\t// create a new JMX server listening on a specific port\n\tJmxServer jmxServer = new JmxServer(JMX_PORT);\n\t// NOTE: you could also use the platform mbean server:\n\t// JmxServer jmxServer = new JmxServer(ManagementFactory.getPlatformMBeanServer());\n\t\n\t// start the server\n\tjmxServer.start();\n \t\n\t// create the object we will be exposing with JMX\n\tRuntimeCounter counter = new RuntimeCounter();\n\t// register our object\n\tjmxServer.register(counter);\n\t...\n\t// shutdown our server\n\tjmxServer.stop();\n\t...\n\nHere's the class we are publishing via the server.  The class is annotated with `@JmxResource` to define the bean\nname.  The fields and get/set methods are annotated to show attributes (`@JmxAttributeField`, `@JmxAttributeMethod`).\nOther methods can be annotated with `@JmxOperation` to expose them as operations.\n\n\t@JmxResource(domainName = \"j256\")\n\tpublic class RuntimeCounter {\n\t\tprivate long startMillis = System.currentTimeMillis();\n\t\t\n\t\t// we can annotate fields directly to be published, isReadible defaults to true\n\t\t@JmxAttributeField(description = \"Show runtime in seconds\", isWritable = true)\n\t\tprivate boolean showSeconds;\n\t\t\n\t\t// we can annotate getter methods\n\t\t@JmxAttributeMethod(description = \"Run time in seconds or milliseconds\")\n\t\tpublic long getRunTime() {\n\t\t\tlong diffMillis = System.currentTimeMillis() - startMillis;\n\t\t\treturn diffMillis / (showSeconds ? 1000 : 1);\n\t\t}\n\t\t\n\t\t// this is an operation that shows up in the operations tab in jconsole.\n\t\t@JmxOperation(description = \"Reset our start time to the current millis\")\n\t\tpublic String resetStartTime() {\n\t\t\tstartMillis = System.currentTimeMillis();\n\t\t\treturn \"Timer has been reset to current millis\";\n\t\t}\n \t}\n\n# Maven Configuration\n\nMaven packages are published via [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.j256.simplejmx/simplejmx/badge.svg?style=flat-square)](https://mvnrepository.com/artifact/com.j256.simplejmx/simplejmx/latest)\n\n``` xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003ecom.j256.simplejmx\u003c/groupId\u003e\n\t\u003cartifactId\u003esimplejmx\u003c/artifactId\u003e\n\t\u003cversion\u003e2.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n# ChangeLog Release Notes\n\nSee the [ChangeLog.txt file](src/main/javadoc/doc-files/changelog.txt).\n","funding_links":["https://github.com/sponsors/j256","https://patreon.com/j256"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj256%2Fsimplejmx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj256%2Fsimplejmx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj256%2Fsimplejmx/lists"}