01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tctest.spring.bean;
05:
06: import org.aopalliance.intercept.MethodInterceptor;
07: import org.aopalliance.intercept.MethodInvocation;
08:
09: public class SingletonAdvice implements MethodInterceptor,
10: ISingletonAdvice {
11: private int counter = 0;
12:
13: public Object invoke(MethodInvocation invocation) throws Throwable {
14: synchronized (this ) {
15: this .counter++;
16: }
17: return invocation.proceed();
18: }
19:
20: synchronized public int getCounter() {
21: return counter;
22: }
23:
24: }
|