-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bugfix] Allow for one ExistXqueryRegistry per BrokerPool instance
- Loading branch information
1 parent
28c5642
commit e731d3a
Showing
2 changed files
with
19 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,20 +32,31 @@ | |
import org.exquery.restxq.RestXqServiceRegistry; | ||
import org.exquery.restxq.impl.RestXqServiceRegistryImpl; | ||
|
||
import java.util.HashMap; | ||
import java.util.IdentityHashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* | ||
* @author <a href="mailto:[email protected]">Adam Retter</a> | ||
*/ | ||
public final class RestXqServiceRegistryManager { | ||
|
||
private final static Logger LOG = LogManager.getLogger(RestXqServiceRegistryManager.class); | ||
private static final Logger LOG = LogManager.getLogger(RestXqServiceRegistryManager.class); | ||
|
||
private static RestXqServiceRegistryImpl registry = null; | ||
private static Map<BrokerPool, RestXqServiceRegistryImpl> registries = null; | ||
|
||
|
||
public static synchronized RestXqServiceRegistry getRegistry(final BrokerPool pool) { | ||
|
||
if(registry == null) { | ||
|
||
RestXqServiceRegistryImpl registry = null; | ||
if (registries == null) { | ||
registries = new IdentityHashMap<>(); | ||
} else { | ||
registry = registries.get(pool); | ||
} | ||
|
||
if (registry == null) { | ||
LOG.info("Initialising RESTXQ..."); | ||
registry = new RestXqServiceRegistryImpl(); | ||
|
||
|
@@ -64,7 +75,9 @@ public static synchronized RestXqServiceRegistry getRegistry(final BrokerPool po | |
//NOTE: must load registry before listening for registered events | ||
registry.addListener(persistence); | ||
|
||
LOG.info("RESTXQ is ready."); | ||
LOG.info("RESTXQ is ready for eXist-db BrokerPool: " + pool.getId()); | ||
|
||
registries.put(pool, registry); | ||
} | ||
|
||
return registry; | ||
|