private IPersistenceStore getStore(IScope scope, boolean persistent) {
IPersistenceStore store;
if (!persistent) {
// Use special store for non-persistent shared objects
if (!scope.hasAttribute(SO_TRANSIENT_STORE)) {
store = new RamPersistence(scope);
scope.setAttribute(SO_TRANSIENT_STORE, store);
return store;
}
return (IPersistenceStore) scope.getAttribute(SO_TRANSIENT_STORE);
}
// Evaluate configuration for persistent shared objects
if (!scope.hasAttribute(SO_PERSISTENCE_STORE)) {
try {
store = PersistenceUtils.getPersistenceStore(scope, persistenceClassName);
log.info("Created persistence store {} for shared objects", store);
} catch (Exception err) {
log.warn("Could not create persistence store ({}) for shared objects, falling back to Ram persistence", persistenceClassName, err);
store = new RamPersistence(scope);
}
scope.setAttribute(SO_PERSISTENCE_STORE, store);
return store;
}
return (IPersistenceStore) scope.getAttribute(SO_PERSISTENCE_STORE);