Samples JDK
HelloService.java
1 package com.freemindcafe.jmx.sample2.server;
2 
3 public class HelloService implements HelloServiceMBean {
4 
5  private final String name = "Reginald";
6  private int cacheSize = DEFAULT_CACHE_SIZE;
7  private static final int DEFAULT_CACHE_SIZE = 200;
8 
9  public void sayHello() {
10  System.out.println("hello, world");
11  }
12 
13  public int add(int x, int y) {
14  return x + y;
15  }
16 
17  public String getName() {
18  return this.name;
19  }
20 
21  public int getCacheSize() {
22  return this.cacheSize;
23  }
24 
25  public synchronized void setCacheSize(int size) {
26  this.cacheSize = size;
27  System.out.println("Cache size now " + this.cacheSize);
28  }
29 
30 }