01: /*
02: @COPYRIGHT@
03: */
04: package demo.jmx;
05:
06: import org.springframework.beans.factory.BeanNameAware;
07:
08: /**
09: * Simple service bean
10: */
11: public class Counter implements ICounter, BeanNameAware {
12: private volatile int counter = 0;
13: private String name;
14:
15: public int next() {
16: synchronized (this ) {
17: return counter++;
18: }
19: }
20:
21: public int getCurrent() {
22: return counter;
23: }
24:
25: public String getName() {
26: return this .name;
27: }
28:
29: public void setBeanName(String name) {
30: this.name = name;
31: }
32: }
|