tkdbaba
tkdbaba

Reputation: 13

How to modify an attribute which have a no-primitive data type with JMX?

I would like to know if it's possible to modify java.awt.Color attribute through the jConsole. I have a class like this :

public class MyColor implements MyColorMBean {
    private Color background;

    public Color getBackground() {
        return background;
    }

    public void setBackground(Color background) {
        this.background = background;
    }
}

which implements this MBean :

public interface MyColorMBean {
    public Color getBackground();
    public void setBackground(Color background);
}

and when I try to set another value for background (like Color.GREEN for example), it doesn't work... but when I set the type of background to String, it works!

Is it possible to change a no-primitive data type with JMX?

Thanks :)

Upvotes: 0

Views: 397

Answers (1)

Nicholas
Nicholas

Reputation: 16056

This is a limitation in console. If you used a programmatic interface, it would work. I would add Color and String type methods to the Mean (with different names).

Upvotes: 1

Related Questions