Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class AriesEntityManagerFactoryBuilder implements EntityManagerFactoryBui

private boolean complete;

private Map<String, Object> overrides;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i get it right this is normally set only once at a time (when the config changes), so maybe make it an AtomicReference ?



public AriesEntityManagerFactoryBuilder(BundleContext containerContext, PersistenceProvider provider, Bundle providerBundle, PersistenceUnit persistenceUnit) {
Expand Down Expand Up @@ -210,7 +211,11 @@ private Map<String, Object> processProperties(Map<String, Object> props) {
for(String key : punitProps.stringPropertyNames()) {
processed.put(key, punitProps.get(key));
}

synchronized (this) {
if (overrides != null) {
processed.putAll(overrides);
}
}
if(props != null) {
processed.putAll(props);
}
Expand Down Expand Up @@ -537,4 +542,8 @@ private void dataSourceReady(DataSource ds, Map<String, Object> props) {
}
createEntityManagerFactory(props);
}

public synchronized void setOverrides(Map<String, Object> overrides) {
this.overrides = overrides;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void updated(Dictionary<String, ?> properties) throws ConfigurationExcept
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Using properties override {}", overrides);
}

builder.setOverrides(overrides);
builder.createEntityManagerFactory(overrides);
configured.set(true);
}
Expand Down