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%2Finternal%2FUndoClusterUpdateProcessor.java;h=e75e2e0ceae71ad77da44d013442b6f10a996e11;hp=d545e51adb02d9d1633e149df36cd9dc9b9be7ab;hb=33b349001037197a526a49e5820f0317dc74d934;hpb=976581876c7f7b734d57d1c70cf4b309006c8b52 diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/internal/UndoClusterUpdateProcessor.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/internal/UndoClusterUpdateProcessor.java index d545e51ad..e75e2e0ce 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/internal/UndoClusterUpdateProcessor.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/internal/UndoClusterUpdateProcessor.java @@ -5,51 +5,38 @@ import java.util.Arrays; import java.util.List; import org.simantics.acorn.ClusterManager; +import org.simantics.acorn.exception.AcornAccessVerificationException; +import org.simantics.acorn.exception.IllegalAcornStateException; import org.simantics.acorn.lru.ClusterChangeSet; import org.simantics.acorn.lru.ClusterStreamChunk; import org.simantics.acorn.lru.ClusterChangeSet.Entry; import org.simantics.acorn.lru.ClusterChangeSet.Type; import org.simantics.db.exception.DatabaseException; import org.simantics.db.service.ClusterUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class UndoClusterUpdateProcessor extends ClusterUpdateProcessorBase { - + + private static final Logger LOGGER = LoggerFactory.getLogger(UndoClusterUpdateProcessor.class); + public final static boolean DEBUG = false; final private ClusterChangeSet ccs; - + private int oldValuesIndex = 0; private int statementMaskIndex = 0; - - final public List entries = new ArrayList(); + + final public List entries = new ArrayList<>(); public UndoClusterUpdateProcessor(ClusterManager client, ClusterStreamChunk chunk, ClusterChangeSet ccs) throws DatabaseException { super(client, readOperation(client, chunk, ccs)); this.ccs = ccs; } - private static byte[] readOperation(ClusterManager manager, ClusterStreamChunk chunk, ClusterChangeSet ccs) { - -// ClusterStreamChunk chunk; -// manager.streamLRU.acquireMutex(); -// try { -// chunk = ccs.getChunk(manager); -// } catch (Throwable t) { -// throw new IllegalStateException(t); -// } finally { -// manager.streamLRU.releaseMutex(); -// } -// -// chunk.acquireMutex(); -// try { -// chunk.ve - chunk.makeResident(); - return chunk.getOperation(ccs.chunkOffset); -// } catch (Throwable t) { -// throw new IllegalStateException(t); -// } finally { -// chunk.releaseMutex(); -// } + private static byte[] readOperation(ClusterManager manager, ClusterStreamChunk chunk, ClusterChangeSet ccs) throws AcornAccessVerificationException, IllegalAcornStateException { + chunk.makeResident(); + return chunk.getOperation(ccs.chunkOffset); } @Override @@ -108,5 +95,10 @@ public class UndoClusterUpdateProcessor extends ClusterUpdateProcessorBase { } } - + + @Override + void setImmutable(boolean value) { + LOGGER.error("Attempted to undo `setImmutable({})` cluster operation for cluster {} which is not supported.", value, ccs.cuid); + } + }