}
}
public synchronized void addInterceptor(Interceptor i, Class<? extends Interceptor> afterInterceptor)
{
InterceptorChainFactory factory = componentRegistry.getComponent(InterceptorChainFactory.class);
List<Interceptor> interceptors = getInterceptors();
int position = -1;
boolean found = false;
for (Interceptor interceptor : interceptors)
{
position++;
if (interceptor.getClass().equals(afterInterceptor))
{
found = true;
break;
}
}
if (found)
{
componentRegistry.registerComponent(i, Interceptor.class);
interceptors.add(++position, i);
setInterceptorChain(factory.correctInterceptorChaining(interceptors));
componentRegistry.start();
// make sure I start the last 2 "manually startable" components
startManualComponents();
}
}