Skip to content

Commit

Permalink
Fixed SQLite lock err + ClusterListener uses handlercount from sysconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
codingchili committed Nov 3, 2017
1 parent 8e03c11 commit 897b721
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void stop(Future<Void> stop) {
@Override
public int instances() {
return (handler instanceof DeploymentAware) ?
((DeploymentAware) handler).instances() : Configurations.system().getListeners();
((DeploymentAware) handler).instances() : Configurations.system().getHandlers();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public IndexedMap(Future<AsyncStorage<Value>> future, StorageContext<Value> 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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -34,7 +35,7 @@ public static <Value extends Storable> SharedIndexCollection<Value> onHeap(
public static <Value extends Storable> SharedIndexCollection<Value> onDisk(
StorageContext<Value> ctx, SimpleAttribute<Value, String> 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());
}
Expand Down

0 comments on commit 897b721

Please sign in to comment.