X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.acorn%2Fsrc%2Forg%2Fsimantics%2Facorn%2Flru%2FClusterInfo.java;h=f058a559d9ca54960d061b2493a9bbf600d91953;hp=57dfe9f41442c0a327012e5f98efe02145bf2cba;hb=e5c006a3e29dcb1f29ae5bcc21ac28573bd37648;hpb=f23dc81afe57e77d20706a9a94002ce4c72f670d diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/lru/ClusterInfo.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/lru/ClusterInfo.java index 57dfe9f41..f058a559d 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/lru/ClusterInfo.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/lru/ClusterInfo.java @@ -20,9 +20,12 @@ import org.simantics.db.exception.SDBException; import org.simantics.db.service.Bytes; import org.simantics.db.service.ClusterUID; import org.simantics.utils.datastructures.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ClusterInfo extends LRUObject implements Persistable { - + + private static final Logger LOGGER = LoggerFactory.getLogger(ClusterInfo.class); final private ClusterManager manager; private ClusterImpl cluster; public int changeSetId; @@ -32,7 +35,7 @@ public class ClusterInfo extends LRUObject implements P // Stub public ClusterInfo(ClusterManager manager, LRU LRU, Path readDirectory, ClusterUID uid, int offset, int length) throws AcornAccessVerificationException { - super(LRU, uid, readDirectory, uid.toString() + ".cluster", offset, length, false, false); + super(LRU, manager.getFileCache(), uid, readDirectory, uid.toString() + ".cluster", offset, length, false, false); this.manager = manager; this.cluster = null; LRU.map(this); @@ -40,7 +43,7 @@ public class ClusterInfo extends LRUObject implements P // New public ClusterInfo(ClusterManager manager, LRU LRU, ClusterImpl cluster) throws AcornAccessVerificationException, IllegalAcornStateException { - super(LRU, cluster.getClusterUID(), LRU.getDirectory(), cluster.getClusterUID().toString() + ".cluster", true, true); + super(LRU, manager.getFileCache(), cluster.getClusterUID(), LRU.getDirectory(), cluster.getClusterUID().toString() + ".cluster", true, true); this.manager = manager; this.cluster = cluster; LRU.insert(this, accessTime); @@ -245,11 +248,9 @@ public class ClusterInfo extends LRUObject implements P } public ClusterImpl getForUpdate() throws SDBException { + acquireMutex(); try { - acquireMutex(); - assert(updateState != null); - makeResident(); setDirty(true); updateState.beginUpdate(); @@ -330,7 +331,8 @@ public class ClusterInfo extends LRUObject implements P long start = System.nanoTime(); state.waitForUpdates(); long duration = System.nanoTime() - start; - System.err.println("Wait updates to cluster " + getKey() + " for " + (1e-6 * duration) + "ms."); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Wait updates to cluster " + getKey() + " for " + (1e-6 * duration) + "ms."); } } @@ -338,5 +340,9 @@ public class ClusterInfo extends LRUObject implements P protected boolean overwrite() { return true; } - + + @Override + public Logger getLogger() { + return LOGGER; + } } \ No newline at end of file