0

How can I implement JMX in my java code to show measure on JMX counter. what XML file I need like MBEAN. Please I need some guidance its very imp.

I ultimately build a jar file and run from the terminal . So what all to implement there in the code needs to be done?

addytheriot
  • 31
  • 1
  • 6

1 Answers1

0

Since you are using Spring, I would start in the Spring docs here: JMX. The documentation is well written and describes exactly how to do this.

Nicholas
  • 15,916
  • 4
  • 42
  • 66
  • Yeah , I have read it before but do you think as I already have a code where I just need to implement a JMX as on the server side . I have already Implement – addytheriot Sep 25 '17 at 19:42
  • import org.springframework.jmx.export.annotation.ManagedAttribute; import org.springframework.jmx.export.annotation.ManagedResource; – addytheriot Sep 25 '17 at 19:46
  • @ManagedResource(objectName = "com.carrieriq:name=AssemblyLineStreamer", description = "This bean will allows " + "Some executions for the binary feed process") @ManagedAttribute(description="RTI: Gets the maximum execution") public int getExecutions() { return mExecutions; but this is not enough to show mw my JMX counters on jconsole what else I need – addytheriot Sep 25 '17 at 19:46
  • So do you think all I need is to implement a BEAN other than the work I have done? – addytheriot Sep 25 '17 at 19:48
  • yeah sure I can . – addytheriot Sep 25 '17 at 21:46
  • Its a very big code actually But let me try to post something more meaningful. – addytheriot Sep 25 '17 at 21:53
  • I am not able to post the code as its a big code so it has indentation problem. – addytheriot Sep 25 '17 at 22:23
  • How about a gist ? – Nicholas Sep 25 '17 at 23:00
  • Okay let me see what I can do about it. I have to push the code there. let me try . Just wanted to ask you , so what if we want to call and JMX implemented code into an bean . – addytheriot Sep 26 '17 at 00:48
  • Lets suppose I have code x where there is complete implementation of the JMX and Mbean. I want to know that if I have a code Y where there is no jmx and I want to use the properties of the JMX from the code X which is in different package altogether thru bean how can that be possible. I havent gone thru that document bcz of lot of pending work . But just wanted to know in general. – addytheriot Sep 26 '17 at 00:51
  • Sure. Using Spring, you can inject the instance of X into the instance of Y and delegate all the JMX calls from Y to X. – Nicholas Sep 26 '17 at 11:16