View Javadoc

1   /*
2    * Created on Dec 15, 2003
3    * 
4    */
5   package org.neo.swarm.interceptor.asyncQueue;
6   
7   import org.neo.swarm.core.aop.Aspect;
8   import org.neo.swarm.core.aop.AspectComponent;
9   import org.neo.swarm.core.aop.silc.comp.MethodInterceptor;
10  import org.neo.swarm.core.aop.silc.comp.Perspective;
11  import org.neo.swarm.core.aop.silc.comp.Pointcut;
12  import org.neo.swarm.core.aop.silc.comp.RegexPointCut;
13  
14  /***
15   * A local or remote async based interceptor that decouples invocations. Implementations of this queue can be used to report
16   * health stats to the container as well as alert JMX properties when the queue reaches alert state.
17   * 
18   * @author navery
19   */
20  public class AsyncQueue implements Aspect {
21  	Pointcut pointcut = new RegexPointCut("(.*).seda(.*)");
22  	private MethodInterceptor interceptor;
23  
24  	
25  	
26  	public AsyncQueue(int queueSize) {
27  		this.interceptor = new AsyncInterceptor(queueSize);
28  	}
29  	
30  	public void advise(AspectComponent componentInstance) {
31  		pointcut.advise(Perspective.DEFAULT, componentInstance, interceptor);
32  	}
33  	public MethodInterceptor getInterceptor() {
34  		return interceptor;
35  	}
36  
37  	public void replaceInterceptor(MethodInterceptor interceptor) {
38  		this.interceptor = interceptor;
39  	}
40  }