StoreLockedException

class StoreLockedException(message: String, val directory: Path?, val holder: LockHolder?, cause: Throwable? = null) : StoreException

Another process — or another DocumentStore in this process — already holds the directory.

The engine is single-writer by design, and the lock file is what makes that a guarantee rather than a convention. Two writers over one LSM directory do not produce a merge conflict; they produce two interleaved logs and an unrecoverable sequence space.

For a desktop, CLI or plugin application this is the normal second-launch case, not a fault, and it is why this carries directory and holder rather than only a message. An application that has to distinguish "someone already has this open" from a genuine IO failure should be able to do it by type and read the details from properties — matching on a message string is not distinguishing them, and it breaks the first time the wording improves.

val db = try {
Rabosh.open(directory)
} catch (locked: StoreLockedException) {
val who = locked.holder
if (who != null && who.isRunning) focusExistingWindow(who.pid) else reportStaleLock(locked.directory)
return
}

There is no way to take the lock, and there will not be one. No stealing, no timeout, no "force open" — each of those converts a clear failure into a corrupt store, which is precisely the thing the lock exists to prevent. What is offered instead is enough information to say who has it.

Constructors

Link copied to clipboard
constructor(message: String, directory: Path?, holder: LockHolder?, cause: Throwable? = null)
constructor(message: String, cause: Throwable? = null)

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard

the directory that could not be locked, or null for an instance built through the deprecated constructor below. The engine always supplies it.

Link copied to clipboard

who the lock file says is holding it, or null when nothing could be read — an older release wrote no record, and a record being written concurrently is not waited for. Absent is the conservative answer and never a guess.

Link copied to clipboard
open val message: String?