martint / jmxutils
- Source
- Commits
- Network (3)
- Issues (0)
- Downloads (11)
- Wiki (1)
- Graphs
-
Branch:
master
Martin Traverso (author)
Thu Jan 21 00:56:08 -0800 2010
commit b86a32ff4f01c824f98424c969c81cd2c7be9c7a
tree 37b554410f0f13bbaecd5f546eac40a6cec29087
parent 0e18260df83827392541e4fd4fa3535544b423cf
tree 37b554410f0f13bbaecd5f546eac40a6cec29087
parent 0e18260df83827392541e4fd4fa3535544b423cf
jmxutils /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
CHANGES | ||
| |
README.md | Thu Jan 21 00:56:08 -0800 2010 | |
| |
pom.xml | Tue Dec 08 17:32:11 -0800 2009 | |
| |
src/ | Tue Dec 08 17:18:05 -0800 2009 |
README.md
Example
class ManagedObject
{
@Managed
public int getValue()
{
...
}
@Managed
public void setValue(int value)
{
...
}
@Managed(description="do the operation")
public void operation()
{
...
}
}
...
MBeanExporter exporter = new MBeanExporter(ManagementFactory.getPlatformMBeanServer());
exporter.export("test:name=X", new ManagedObject());
Guice support
Injector injector = Guice.createInjector(
new AbstractModule() {
@Override
protected void configure() {
// MBeanModules expect an MBeanServer to be bound
binder().bind(MBeanServer.class).toInstance(ManagementFactory.getPlatformMBeanServer());
}
},
new MBeanModule() {
@Override
protected void configureMBeans()
{
export(ManagedObject.class).as("test:name=X");
export(ManagedObject.class).annotatedWith(SomeAnnotation.class).as("test:name=Y");
}
}, ...);
Injector injector = Guice.createInjector(
new MBeanModule(), // used to trigger registration of mbeans exported via ExportBuilder
new AbstractModule() {
@Override
protected void configure() {
// MBeanModule expects an MBeanServer to be bound
binder().bind(MBeanServer.class).toInstance(ManagementFactory.getPlatformMBeanServer());
ExportBuilder builder = MBeanModule.newExporter(binder());
builder.export(AnotherManagedObject.class).as("test:name="Z");
// You can use a standardized naming scheme for singletons if you wish.
// See ObjectNames.generatedNameOf(Class<?>) for the naming scheme.
builder.export(ManagedSingleton.class).withGeneratedName();
}
}, ...);
Maven dependency
To use jmxutils in maven projects:
<dependency>
<groupId>org.weakref</groupId>
<artifactId>jmxutils</artifactId>
<version>1.4</version>
</dependency>
License
Licensed under the Apache License, Version 2.0 (the "License")
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

