eclipse-platform / eclipse-platform/eclipse.platform

Expose API to allow querying for Workspace lock

Open
#360 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
165
Forks
174
Avg merge
2d 8h
Merged PRs (30d)
22

Description

I believe there is value in having an API to check whether the current thread owns the workspace lock. This would allow implementing something like deadlock prevention as a safeguard.

Right now it is possible using internals:
```
var workspace = ResourcesPlugin.getWorkspace();
try {
if (((Workspace) workspace).getWorkManager().isLockAlreadyAcquired()) {
throw new IllegalStateException(format(
"The current thread (%s) already owns the workspace lock. Calling get() will almost certainly cause a deadlock!",
Thread.currentThread()));
}
} catch (CoreException e) {
throw new IllegalStateException("The workspace is shutdown!", e);
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.