Lock File

By default, EclipseStore uses the operation system’s standard file locking mechanism to prevent simultaneous access to the storage files. In the rare case that this is not sufficient to control the file access EclipseStore provides a proprietary file lock implementation to ensure exclusive access to the storage files from different applications using EclipseStore.

Using this file lock may only be necessary if, while a EclipseStore application is running, a second EclipseStore application may try to access the same storage and the default file locks are not reliable.

You don’t need to activate this feature if:

  • Only one EclipseStore application will access the storage,

  • EclipseStore applications that may access the same storage run on the same system,

  • other applications that may access the storage files don’t use EclipseStore to access them.

To activate the internal file lock you need to setup StorageLockFileSetup:

EmbeddedStorageManager storageManager = EmbeddedStorage
	.Foundation()
	.setLockFileSetupProvider(Storage.LockFileSetupProvider())
	.start();

The default interval the locks are updated is 10 seconds, you can set a custom value in milliseconds with:

Storage.LockFileSetupProvider( final long updateInterval )

To specify the charset used by the lock files use:

Storage.LockFileSetupProvider( final Charset charset )

or, to customize both:

LockFileSetupProvider( final Charset charset , final long updateInterval )