private void fetchEntry(String key) {
Map localRegistry = synapseConfiguration.getLocalRegistry();
Object o = localRegistry.get(key);
if (o != null && o instanceof Entry) {
Entry entry = (Entry) o;
// This must be a dynamic entry whose cache has expired or which is not cached at all
// A registry lookup is in order
if (registry != null) {
if (entry.isCached()) {
try {
Object resource = getResource(entry, synapseConfiguration.getProperties());
if (resource == null) {
log.warn("Failed to load the resource at the first time, " +
"non-existing resource: " + key);
} else {
entry.setExpiryTime(Long.MAX_VALUE);
}
onSuccess();
} catch (Exception e) {
// Error occured while loading the resource from the registry
// Fall back to the cached value - Do not increase the expiry time
log.warn("Error while loading the resource " + key + " from the remote " +
"registry. Previously cached value will be used. Check the " +
"registry accessibility.");
onError();
}
} else {
try {
// Resource not available in the cache - Must load from the registry
// No fall backs possible here!!
Object resource = getResource(entry, synapseConfiguration.getProperties());
if (resource == null) {
log.warn("Failed to load the resource at the first time, " +
"non-existing resource: " + key);
} else {
entry.setExpiryTime(Long.MAX_VALUE);
}
} catch (Exception e) {
// failed to get the resource for the first time
log.warn("Failed to load the resource at the first time, " +
"non-existing resource: " + key);
}
}
} else {
if (entry.isCached()) {
// Fall back to the cached value
log.warn("The registry is no longer available in the Synapse configuration. " +
"Using the previously cached value for the resource : " + key);
} else {
if (log.isDebugEnabled()) {