2

My MBeans are annotated using Spring annotations as follows:

@ManagedAttribute(description = "returns the name")
    public String getName() {
        return name;
    }

Now, whenever I open a JMX Console (be it VisualVM or JConsole), I can see the attributes of my beans in the Attributes tab, but I can also see the getName() method exposed in the Operations tab. Is there a way in which I can only see the attribute in the Attribute tab (i.e. hide it from the Operations tab)?

anton4o
  • 499
  • 1
  • 4
  • 12

1 Answers1

2

AbstractReflectiveMBeanInfoAssembler has this code since 2008:

// Attributes need to have their methods exposed as
// operations to the JMX server as well.

If you see the descriptor part of the javax.management.modelmbean.ModelMBeanOperationInfo, you'll see that there are parameters role=getter and visibility=4, which should (it depends on application that displays attributes/operations) be hidden somehow.

See more details under https://jira.spring.io/browse/SPR-4232.

Grzegorz Grzybek
  • 6,152
  • 3
  • 29
  • 42
  • Thanks for the info! What I find really weird is that when browsing some of the JVM Mbeans through VisualVM, I can see lots of mbeans which have their attributes exposed, but none of the getters/setters, which makes me think that there must be a way in which you can circumvent the above-mentioned code in the AbstractReflectiveMBeanInfoAssembler and implement this. Also, even if you can define the visibility param of a method, how can you make VisualVm disregard (i.e. not show) an operation which, say, has a visibility rating of 4? – anton4o Dec 07 '15 at 12:29