• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

How to define sig[] and args[] in invoke() method in JMX?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anybody know how to define args[] and sig[] for the following situation.

If I have

public void upload(String filename, byte[] data);
public int add(int a, int b);

in the mbean,

how should I define args[] and sig[] for them?

Thanks for your help.
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For


public void upload(String filename, byte[] data);


args or param will look something like below

String strType;
byte[] byteArrayType;
Object[] params = new Object[]{strType, byteArrayType};
String[] signature = new String[] { "java.lang.String","[B"}

"[B" is internal representation for byte array.
and for

public int add(int a, int b);



Object[] params = new Object[]{new Integer(5), new Integer(10)};
String signature = new String[] {"int", "int"};

Should work.

But it's better to consider using MBeanServerInvocationHandler.newProxyInstance method to get MBean Proxy and work with that.
 
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


But it's better to consider using MBeanServerInvocationHandler.newProxyInstance method to get MBean Proxy and work with that.



Thanks for the this tip Purushothoman, it helped me out of a frustrating issue!
 
Yup, yup, yup. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic