github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

martint / jmxutils

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 15
    • 3
  • Source
  • Commits
  • Network (3)
  • Issues (0)
  • Downloads (11)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (7)
    • 1.4
    • 1.3.1
    • 1.3
    • 1.2.3
    • 1.2.2
    • 1.1
    • 1.0.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Exporting JMX mbeans made easy — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

instructions for using in maven projects 
Martin Traverso (author)
Thu Jan 21 00:56:08 -0800 2010
commit  b86a32ff4f01c824f98424c969c81cd2c7be9c7a
tree    37b554410f0f13bbaecd5f546eac40a6cec29087
parent  0e18260df83827392541e4fd4fa3535544b423cf
jmxutils /
name age
history
message
file .gitignore Loading commit data...
file CHANGES
file README.md Thu Jan 21 00:56:08 -0800 2010 instructions for using in maven projects [Martin Traverso]
file pom.xml Tue Dec 08 17:32:11 -0800 2009 [maven-release-plugin] prepare for next develop... [Martin Traverso]
directory src/ Tue Dec 08 17:18:05 -0800 2009 Generate object names using class and optional ... [Adam Rosien]
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.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server