1 16 17 package org.springframework.aop.interceptor; 18 19 import java.io.Serializable ; 20 21 import org.aopalliance.intercept.MethodInterceptor; 22 import org.aopalliance.intercept.MethodInvocation; 23 24 import org.springframework.util.ConcurrencyThrottleSupport; 25 26 42 public class ConcurrencyThrottleInterceptor extends ConcurrencyThrottleSupport 43 implements MethodInterceptor, Serializable { 44 45 public ConcurrencyThrottleInterceptor() { 46 setConcurrencyLimit(1); 47 } 48 49 public Object invoke(MethodInvocation methodInvocation) throws Throwable { 50 beforeAccess(); 51 try { 52 return methodInvocation.proceed(); 53 } 54 finally { 55 afterAccess(); 56 } 57 } 58 59 } 60 | Popular Tags |