1 22 package org.jboss.aspects; 23 24 import org.jboss.aop.joinpoint.FieldReadInvocation; 25 import org.jboss.aop.joinpoint.FieldWriteInvocation; 26 27 34 public class ThreadbasedAspect 35 { 36 private ThreadLocal threadbased = new ThreadLocal (); 37 38 public Object access(FieldReadInvocation invocation) throws Throwable  39 { 40 if (threadbased.get() == null) return invocation.invokeNext(); 42 return threadbased.get(); 43 } 44 45 public Object access(FieldWriteInvocation invocation) throws Throwable  46 { 47 threadbased.set(invocation.getValue()); 48 return null; 49 } 50 } 51 | Popular Tags |