Skip to content

Commit 78c34d2

Browse files
committed
[bugfix] Allow for one ExistXqueryRegistry per BrokerPool instance
1 parent 6679db0 commit 78c34d2

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

exist-core/src/main/java/org/exist/storage/NativeBroker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ public NativeBroker(final BrokerPool pool, final Configuration config) throws EX
248248
this.indexConfiguration = (IndexSpec) config.getProperty(Indexer.PROPERTY_INDEXER_CONFIG);
249249
this.xmlSerializerPool = new XmlSerializerPool(this, config, 5);
250250

251+
pushSubject(pool.getSecurityManager().getSystemSubject());
251252
try {
252-
pushSubject(pool.getSecurityManager().getSystemSubject());
253253
//TODO : refactor so that we can,
254254
//1) customize the different properties (file names, cache settings...)
255255
//2) have a consistent READ-ONLY behaviour (based on *mandatory* files ?)

extensions/exquery/restxq/src/main/java/org/exist/extensions/exquery/restxq/impl/RestXqServiceRegistryManager.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,31 @@
3232
import org.exquery.restxq.RestXqServiceRegistry;
3333
import org.exquery.restxq.impl.RestXqServiceRegistryImpl;
3434

35+
import java.util.HashMap;
36+
import java.util.IdentityHashMap;
37+
import java.util.Map;
38+
3539
/**
3640
*
3741
* @author <a href="mailto:[email protected]">Adam Retter</a>
3842
*/
3943
public final class RestXqServiceRegistryManager {
4044

41-
private final static Logger LOG = LogManager.getLogger(RestXqServiceRegistryManager.class);
45+
private static final Logger LOG = LogManager.getLogger(RestXqServiceRegistryManager.class);
4246

43-
private static RestXqServiceRegistryImpl registry = null;
47+
private static Map<BrokerPool, RestXqServiceRegistryImpl> registries = null;
4448

4549

4650
public static synchronized RestXqServiceRegistry getRegistry(final BrokerPool pool) {
47-
48-
if(registry == null) {
51+
52+
RestXqServiceRegistryImpl registry = null;
53+
if (registries == null) {
54+
registries = new IdentityHashMap<>();
55+
} else {
56+
registry = registries.get(pool);
57+
}
58+
59+
if (registry == null) {
4960
LOG.info("Initialising RESTXQ...");
5061
registry = new RestXqServiceRegistryImpl();
5162

@@ -64,7 +75,9 @@ public static synchronized RestXqServiceRegistry getRegistry(final BrokerPool po
6475
//NOTE: must load registry before listening for registered events
6576
registry.addListener(persistence);
6677

67-
LOG.info("RESTXQ is ready.");
78+
LOG.info("RESTXQ is ready for eXist-db BrokerPool: " + pool.getId());
79+
80+
registries.put(pool, registry);
6881
}
6982

7083
return registry;

0 commit comments

Comments
 (0)