cr = gcr.getNamedComponentRegistry(cacheName);
}
if (cr == null) {
if (log.isInfoEnabled()) log.info("Cache named {0} does not exist on this cache manager!", cacheName);
return new ExceptionResponse(new NamedCacheNotFoundException(cacheName));
}
Configuration localConfig = cr.getComponent(Configuration.class);
if (!cr.getStatus().allowInvocations()) {
giveupTime = System.currentTimeMillis() + localConfig.getStateRetrievalTimeout();
while (cr.getStatus().startingUp() && System.currentTimeMillis() < giveupTime) Thread.sleep(100);
if (!cr.getStatus().allowInvocations()) {
log.warn("Cache named [{0}] exists but isn't in a state to handle invocations. Its state is {1}.", cacheName, cr.getStatus());
return RequestIgnoredResponse.INSTANCE;
}
}
CommandsFactory commandsFactory = cr.getLocalComponent(CommandsFactory.class);
// initialize this command with components specific to the intended cache instance
commandsFactory.initializeReplicableCommand(cmd);
try {
log.trace("Calling perform() on {0}", cmd);
Object retval = cmd.perform(null);
return cr.getComponent(ResponseGenerator.class).getResponse(cmd, retval);
} catch (Exception e) {
return new ExceptionResponse(e);
}
}