XtextDocument should provide non-blocking API for reading/modifying a resource

Open
#2,469 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
api, tooling

Research direction

Start with the XtextDocument API and the java.util.concurrent.locks.Lock tryLock() and timed tryLock(long, TimeUnit) patterns named in the issue. Define non-blocking read and modify methods, including tryReadOnly and the corresponding modify convenience method, with default values returned when a lock cannot be acquired.

Written by the indexing model from the issue text.

Description

XtextDocument should provide non-blocking methods for reading / modifying the resource.

  1. This would require methods following the pattern of

    • java.util.concurrent.locks.Lock#tryLock() and
    • java.util.concurrent.locks.Lock.tryLock(long, TimeUnit)

    (each for reading and modifying).

  2. For convenience, additional methods as follows would be helpful:

    /**
     * Like `#readOnly(IUnitOfWork)`, but won't block if a read-lock cannot be acquired
     * at this time; instead, the given default value will be returned in this case)
     */
    public <T> T tryReadOnly(IUnitOfWork<T, XtextResource> work, T defaultValue) {
        ...
    

    (and for modify, accordingly).

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from eclipse-xtext/xtext

All issues in eclipse-xtext/xtext

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.