diff --git a/core/main/java/com/codingchili/core/listener/transport/ClusterListener.java b/core/main/java/com/codingchili/core/listener/transport/ClusterListener.java index ebd256a5..5340c30a 100644 --- a/core/main/java/com/codingchili/core/listener/transport/ClusterListener.java +++ b/core/main/java/com/codingchili/core/listener/transport/ClusterListener.java @@ -57,7 +57,7 @@ public void stop(Future stop) { @Override public int instances() { return (handler instanceof DeploymentAware) ? - ((DeploymentAware) handler).instances() : Configurations.system().getListeners(); + ((DeploymentAware) handler).instances() : Configurations.system().getHandlers(); } @Override diff --git a/core/main/java/com/codingchili/core/storage/IndexedMap.java b/core/main/java/com/codingchili/core/storage/IndexedMap.java index 12893cb1..20c025c6 100644 --- a/core/main/java/com/codingchili/core/storage/IndexedMap.java +++ b/core/main/java/com/codingchili/core/storage/IndexedMap.java @@ -53,13 +53,13 @@ public IndexedMap(Future> future, StorageContext cont executor = context.vertx().createSharedWorkerExecutor("IndexedMap", 1); FIELD_ID = attribute(context.clazz(), String.class, Storable.idField, Storable::id); fields.put(Storable.idField, FIELD_ID); - this.db = getImplementation(context, FIELD_ID); // share collections that share the same identifier. synchronized (maps) { if (maps.containsKey(context.identifier())) { db = maps.get(context.identifier()); } else { + db = getImplementation(context, FIELD_ID); db.addIndex(UniqueIndex.onAttribute(FIELD_ID)); maps.put(context.identifier(), db); } diff --git a/core/main/java/com/codingchili/core/storage/SharedIndexCollection.java b/core/main/java/com/codingchili/core/storage/SharedIndexCollection.java index 66565290..72168915 100644 --- a/core/main/java/com/codingchili/core/storage/SharedIndexCollection.java +++ b/core/main/java/com/codingchili/core/storage/SharedIndexCollection.java @@ -1,5 +1,6 @@ package com.codingchili.core.storage; +import com.codingchili.core.configuration.CoreStrings; import com.codingchili.core.context.StorageContext; import com.googlecode.cqengine.ConcurrentIndexedCollection; import com.googlecode.cqengine.attribute.SimpleAttribute; @@ -34,7 +35,7 @@ public static SharedIndexCollection onHeap( public static SharedIndexCollection onDisk( StorageContext ctx, SimpleAttribute attribute) { synchronized (SharedIndexCollection.class) { - File file = new File(ctx.dbPath()).getParentFile(); + File file = new File(CoreStrings.DB_DIR); if (!file.exists() && !file.mkdirs()) { throw new RuntimeException("Failed to create dirs for DB " + file.toPath().toAbsolutePath()); }