[
https://issues.apache.org/jira/browse/RYA-414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16310202#comment-16310202
]
ASF GitHub Bot commented on RYA-414:
------------------------------------
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/256#discussion_r159512956
--- Diff:
extras/indexing/src/main/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexer.java
---
@@ -39,44 +35,16 @@
*/
@DefaultAnnotation(NonNull.class)
public class MongoEntityIndexer extends BaseEntityIndexer {
- private MongoClient client;
-
- @Override
- public EntityStorage getEntityStorage(final Configuration conf) throws
EntityStorageException {
- final MongoDBRdfConfiguration mongoConf =
(MongoDBRdfConfiguration) conf;
- if (client == null) {
- if(mongoConf.getMongoClient() != null) {
- client = mongoConf.getMongoClient();
- } else {
- client = MongoConnectorFactory.getMongoClient(conf);
- }
- }
- final String ryaInstanceName = new
MongoDBRdfConfiguration(conf).getMongoDBName();
- return new MongoEntityStorage(client, ryaInstanceName);
- }
-
- @Override
- public TypeStorage getTypeStorage(final Configuration conf) {
- final MongoDBRdfConfiguration mongoConf =
(MongoDBRdfConfiguration) conf;
- if (client == null) {
- if(mongoConf.getMongoClient() != null) {
- client = mongoConf.getMongoClient();
- } else {
- client = MongoConnectorFactory.getMongoClient(conf);
- }
- }
- final String ryaInstanceName = new
MongoDBRdfConfiguration(conf).getMongoDBName();
- return new MongoTypeStorage(client, ryaInstanceName);
- }
-
@Override
- public void init() {
- //nothing to init.
+ public EntityStorage getEntityStorage() throws EntityStorageException {
+ final StatefulMongoDBRdfConfiguration conf =
super.configuration.get();
+ return new MongoEntityStorage(conf.getMongoClient(),
conf.getRyaInstanceName());
}
@Override
- public void setClient(final MongoClient client) {
- this.client = client;
+ public TypeStorage getTypeStorage() {
+ final StatefulMongoDBRdfConfiguration conf =
super.configuration.get();
--- End diff --
Done.
> Fix inconsistent method of using MongoClient within a Sail object
> -----------------------------------------------------------------
>
> Key: RYA-414
> URL: https://issues.apache.org/jira/browse/RYA-414
> Project: Rya
> Issue Type: Bug
> Reporter: Andrew Smith
> Assignee: Kevin Chilton
> Priority: Blocker
>
> We've decided to introduce a stateful configuration object that is used to
> hold onto objects that needs to be shared across components within a Sail
> object in favor of having a static holder. The static holder limited our
> ability to use more than a single Sail object within a single JVM because all
> of those Sail objects would all have to access the same Mongo DB repository.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)