public static boolean replaceInterceptor(Cache cache, CommandInterceptor replacingInterceptor, Class<? extends CommandInterceptor> toBeReplacedInterceptorType) {
ComponentRegistry cr = extractComponentRegistry(cache);
// make sure all interceptors here are wired.
CommandInterceptor i = replacingInterceptor;
do {
cr.wireDependencies(i);
}
while ((i = i.getNext()) != null);
InterceptorChain inch = cr.getComponent(InterceptorChain.class);
return inch.replaceInterceptor(replacingInterceptor, toBeReplacedInterceptorType);
}