MessageContext synCtx = (MessageContext) source;
// On the first check the availability of the key in property bag
Object result = synCtx.getProperty(key);
if (result != null) {
return new ReturnValue(result);
} //Then, it must be a entry key
//reload the XML document from the registry
boolean reLoad = false;
Entry dp = synCtx.getConfiguration().getEntryDefinition(key);
// if the key refers to a dynamic resource
if (dp != null && dp.isDynamic()) {
if (!dp.isCached() || dp.isExpired()) {
reLoad = true;
}
}
if (reLoad) {
// it is need to synchronized this to avoid recreation of the cachedValue by
// the multiple threads
synchronized (resourceLock) {
return new ReturnValue(synCtx.getEntry(key), true);
}
} else {
return new ReturnValue(synCtx.getEntry(key), defaultValue != null);
// recreation by the multiple threads
}
}
return new ReturnValue(defaultValue);
}