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<Entry> entries = new ArrayList<Entry>();
+
+ final public List<Entry> 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
}
}
-
+
+ @Override
+ void setImmutable(boolean value) {
+ LOGGER.error("Attempted to undo `setImmutable({})` cluster operation for cluster {} which is not supported.", value, ccs.cuid);
+ }
+
}