}
actual.initializeReplicableCommand(command, isRemote);
}
public static ControlledCommandFactory registerControlledCommandFactory(Cache cache, Class<? extends ReplicableCommand> toBlock) {
ComponentRegistry componentRegistry = cache.getAdvancedCache().getComponentRegistry();
final ControlledCommandFactory ccf = new ControlledCommandFactory(componentRegistry.getCommandsFactory(), toBlock);
TestingUtil.replaceField(ccf, "commandsFactory", componentRegistry, ComponentRegistry.class);
componentRegistry.registerComponent(ccf, CommandsFactory.class);
//hack: re-add the component registry to the GlobalComponentRegistry's "namedComponents" (CHM) in order to correctly publish it for
// when it will be read by the InboundInvocationHandlder. InboundInvocationHandlder reads the value from the GlobalComponentRegistry.namedComponents before using it
componentRegistry.getGlobalComponentRegistry().registerNamedComponentRegistry(componentRegistry, EmbeddedCacheManager.DEFAULT_CACHE_NAME);
return ccf;
}