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<ClusterUID, ClusterInfo> implements Persistable {
-
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClusterInfo.class);
final private ClusterManager manager;
private ClusterImpl cluster;
public int changeSetId;
// Stub
public ClusterInfo(ClusterManager manager, LRU<ClusterUID, ClusterInfo> 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);
// New
public ClusterInfo(ClusterManager manager, LRU<ClusterUID, ClusterInfo> 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);
}
public ClusterImpl getForUpdate() throws SDBException {
+ acquireMutex();
try {
- acquireMutex();
-
assert(updateState != null);
-
makeResident();
setDirty(true);
updateState.beginUpdate();
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.");
}
}
protected boolean overwrite() {
return true;
}
-
+
+ @Override
+ public Logger getLogger() {
+ return LOGGER;
+ }
}
\ No newline at end of file