Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8122681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:54:31+00:00 2026-06-06T05:54:31+00:00

Is there a way to use abstract or annotated class as MXBean descriptor? I

  • 0

Is there a way to use abstract or annotated class as MXBean descriptor? I have interface like:

@MXBean
public interface Peer {
    public String getName();
}

and want that MXBean to be combined in class with more local-side-only methods like:

public class PeerCombinedMXBean {
    // Expose this as MXBean attribute
    public String getName() { ... }

    // This method is local-instance-oriented
    public boolean isValid() { ... }
}

I need model like above to avoid chain-in proxy object instead to use complex half-proxified instance like:

PeerCombinedMXBean peer = JMX.newMXBeanProxy(connection, name, PeerCombinedMXBean.class);
if (peer.isValid()) System.out.println(peer.getName());

Edit

This question is related to java.net article. What is they progress? Can I use MBeans with annotation safely now?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:54:33+00:00Added an answer on June 6, 2026 at 5:54 am

    What I ended up doing for this was writing a custom annotation that you place on a method or property. Then, I implemented the DynamicMBean interface in such a way that it parsed out the annotations on the class in question and then registers them with the PlatformMBeanServer. As far as I know, there are no public implementations of this available, I also searched extensively about this topic before I just did it myself.

    For example, here is the class that I wish to manage from JConsole:

    public class Foo
    {
      // In JMX Console
      @Managed
      private boolean isBar;
    
      // Not in JMX Console
      private boolean isFoo;
    
      // In JMX Console
      @Managed
      public String getClassName()
      {
        return Foo.class.getName();
      }
    }
    

    Then, when my application starts up, I register an instance of this class using my implementation of DynamicMBean and parse out the annotations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are two way for choosing between abstract class or interface. Microsoft solution and
I have an interface IServiceInfo and an abstract class ServiceInfo. There are several classes
I have a very simple mapping like: public abstract class EntityMap<TEnt, TId, TDto> :
Is there a way to use one() with event delegation? like on() or live()
Is there any relevance of a public constructor in an abstract class? I can
I have a class similar to the following: public abstract class Manager<T, TInterface> :
Say we have an abstract base class IBase with pure virtual methods (an interface).
I have this C# class structure that I would like to refactor to use
Say I have an abstract base class BaseClass . I'd like to give it
I'm trying to use C++ abstract base class in the way similar with Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.