1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 23:15:24 +02:00
cdt/core
Jonah Graham 571d62d6f9 Stop trying to clear result caches when lock isn't held
The indexer has a feature that allows readers of the index
to read the index in the middle of write operations. This
is done by using a YeildableIndexLock.

The YeildableIndexLock's yield method can be called to
temporarily give up the write lock. However the assumption
in the code was that it would always successfully
reaquire the lock after that.

However, if the indexing was cancelled the lock would
fail to be reaquired. Therefore the code that thinks it
owns the lock no longer owns it. In this case the code
in PDOMWriter.storeSymbolsInIndex's finally block.

Therefore I have added an new exception type to explicitly
identify this use case so the original code can differentiate
between cases where an exception was thrown where the lock
is still held, and cases where the lock is no longer held.

Note that instead of a new exception caught like this:

```java
} catch (FailedToReAcquireLockException e) {
    hasLock = false;
    e.reThrow();
```

I could have done this:

```java
} catch (InterruptedException | OperationCanceledException e) {
    hasLock = false;
    throw e;
```

But it is not obvious that nothing else other than the
acquire can raise an OperationCanceledException because it
is a RuntimeException. By having a new checked exception we
can know for sure that in the finally block we have lost
our lock.

There are no API implications of this change as all the classes
and interfaces are internal to CDT.

Fixes #128
2022-11-07 17:31:56 -05:00
..
org.eclipse.cdt.core Stop trying to clear result caches when lock isn't held 2022-11-07 17:31:56 -05:00
org.eclipse.cdt.core.linux Upgrade build.properties warnings to errors 2022-11-06 18:29:28 -05:00
org.eclipse.cdt.core.linux.aarch64 Upgrade build.properties warnings to errors 2022-11-06 18:29:28 -05:00
org.eclipse.cdt.core.linux.ppc64le Upgrade build.properties warnings to errors 2022-11-06 18:29:28 -05:00
org.eclipse.cdt.core.linux.x86_64 Upgrade build.properties warnings to errors 2022-11-06 18:29:28 -05:00
org.eclipse.cdt.core.macosx Upgrade build.properties warnings to errors 2022-11-06 18:29:28 -05:00
org.eclipse.cdt.core.native Upgrade build.properties warnings to errors 2022-11-06 18:29:28 -05:00
org.eclipse.cdt.core.tests Include the full stack trace in exception message 2022-11-07 10:04:20 -05:00
org.eclipse.cdt.core.win32 Upgrade build.properties warnings to errors 2022-11-06 18:29:28 -05:00
org.eclipse.cdt.core.win32.x86_64 Upgrade build.properties warnings to errors 2022-11-06 18:29:28 -05:00
org.eclipse.cdt.ui Upgrade build.properties warnings to errors 2022-11-06 18:29:28 -05:00
org.eclipse.cdt.ui.tests Delete settings.xml file at end of test 2022-11-07 10:04:20 -05:00
pom.xml [releng] Bump versions for CDT 11.0.0 2022-10-03 12:42:37 -04:00