/** * Add dynamically an operation interceptor, first in the chain. */ public void addOperationInterceptor(Interceptor interceptor) { if (operationContextMap != null && interceptor != null) { // Go through all the operation InvocationContext and add the interceptor for (Iterator it = operationContextMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); InvocationContext ctx = (InvocationContext) entry.getValue(); List list = ctx.getInterceptors(); // to make the interceptor list update atomic, make a new ArrayList, // add the new interceptor first and copy over the old ones, // then update the context List newList = new ArrayList(); newList.add(interceptor); if (list != null) { newList.addAll(list); } ctx.setInterceptors(newList); } } }
/** * Add dynamically an operation interceptor, first in the chain. */ public void addOperationInterceptor(Interceptor interceptor) { if (operationContextMap != null && interceptor != null) { // Go through all the operation InvocationContext and add the interceptor for (Iterator it = operationContextMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); InvocationContext ctx = (InvocationContext) entry.getValue(); List list = ctx.getInterceptors(); // to make the interceptor list update atomic, make a new ArrayList, // add the new interceptor first and copy over the old ones, // then update the context List newList = new ArrayList(); newList.add(interceptor); if (list != null) { newList.addAll(list); } ctx.setInterceptors(newList); } } }
/** * Remove the specified operation interceptor */ public void removeOperationInterceptor(Interceptor interceptor) { if (operationContextMap != null && interceptor != null) { // Go through all the operation InvocationContext and remove the interceptor for (Iterator it = operationContextMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); InvocationContext ctx = (InvocationContext) entry.getValue(); List list = ctx.getInterceptors(); // to make the interceptor list update atomic, make a copy of the list // remove the interceptor (if found), then update the context if (list != null) { List newList = new ArrayList(list); // this should probably work, whether or not equals() is implemented // it'll remove the first occurence newList.remove(interceptor); ctx.setInterceptors(newList); } } } }
/** * Remove the specified operation interceptor */ public void removeOperationInterceptor(Interceptor interceptor) { if (operationContextMap != null && interceptor != null) { // Go through all the operation InvocationContext and remove the interceptor for (Iterator it = operationContextMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); InvocationContext ctx = (InvocationContext) entry.getValue(); List list = ctx.getInterceptors(); // to make the interceptor list update atomic, make a copy of the list // remove the interceptor (if found), then update the context if (list != null) { List newList = new ArrayList(list); // this should probably work, whether or not equals() is implemented // it'll remove the first occurence newList.remove(interceptor); ctx.setInterceptors(newList); } } } }
protected void configureInterceptorStack(ModelMBeanInfo info, MBeanServer server, ObjectName name) throws Exception { // FIXME: do not require super calls super.configureInterceptorStack(info, server, name); if (resourceType.equals(STANDARD_MBEAN)) { List interceptors = getMBeanInfoCtx.getInterceptors(); interceptors.add(0, new StandardMBeanInfoInterceptor()); getMBeanInfoCtx.setInterceptors(interceptors); } }
@SuppressWarnings("unchecked") protected void configureInterceptorStack(ModelMBeanInfo info, MBeanServer server, ObjectName name) throws Exception { // FIXME: do not require super calls super.configureInterceptorStack(info, server, name); if (resourceType.equals(STANDARD_MBEAN)) { List interceptors = getMBeanInfoCtx.getInterceptors(); interceptors.add(0, new StandardMBeanInfoInterceptor()); getMBeanInfoCtx.setInterceptors(interceptors); } }
interceptors = getMBeanInfoCtx.getInterceptors();
interceptors = getMBeanInfoCtx.getInterceptors();