]> gerrit.simantics Code Review - simantics/platform.git/commit
Improved logic in new head state creation. 97/497/2
authorJussi Koskela <jussi.koskela@semantum.fi>
Tue, 9 May 2017 13:12:17 +0000 (16:12 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 9 May 2017 14:37:04 +0000 (17:37 +0300)
commit25c9cc192b2611646b0a476bf205484500e92997
treef0bcb2093bf1292f91b9b28327ebf028eccc146c
parent4881fb88d55e80473a6f3117b0d0b8265a3b66b2
Improved logic in new head state creation.

Earlier any IOException during the reading of head state was interpreted
as empty DB. This might cause unwanted DB reset. It's better to identify
need for empty head state based on main state head directory.

Switched AcornDatabase.start logic back to using RandomAccessFile for
touching the db/lock file. Using RandomAccessFile instead of
FileSystemProvider.newFileChannel in Windows better prevents any other
process from removing the lock file. The newFileChannel version did not
prevent the user from initially running 'del lock' to remove the file -
although the file will be recreated quickly by the system.

Also AcornDatabase.start now re-throws ProCoreException if
opening/locking the lock-file fails with IOException to prevent the
system from attempting to start up without a proper database to work
with. Previously the system just logged the start-up problem and
continued.

refs #7124

Change-Id: I850b47d8f692e3d1b8ce177b9269540edc4dc272
bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java
bundles/org.simantics.acorn/src/org/simantics/acorn/HeadState.java
bundles/org.simantics.acorn/src/org/simantics/acorn/MainState.java
bundles/org.simantics.acorn/src/org/simantics/acorn/internal/AcornDatabase.java