GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Provide modern TrackingFileManager by cstamas · Pull Request #1814 · apache/maven-resolver

Conversation

@cstamas

@cstamas cstamas commented Mar 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Still, provide escape hatch for those that must share their local repository with some parallel running Maven 3.9.x or older.

Changes:

  • provide "legacy" and "named locks" based TrackingFileManager
  • demote both from being components, instead introduce TrackingFileManagerProvider that performs "selection" of wanted instance
  • contains refactoring regarding NamedLocks making them usable system-wide, unlike so far, only in scope of SyncContext that requires session

WIP: as provider still creates the "old" (now legacy) TFM

Refactoring: NamedLocks are a standalone API in Resolver. But SyncContext today is implemented with combination of NamedLocks and NameMapper. But, NameMapper was never a standalone API on its own (is part of synccontext implementation done with NamedLocks), and NameMapper also depends on RepositorySystemSession. This caused that NamedLocks were "washed into same (component) scope" as NameMappers, and made them somewhat unusable outside of a session. Also, due this mixup, NamedLockFactoryAdapterFactoryImpl had to deal with locks lifecycle, totally wrongly (fx it was registering locks lifecycle multiple times while system existed, ie in case of daemon). Registering lifecycle is needed only once.

This refactoring clear things up: NamedLocks do live a life independently of existence of repository system session.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cstamas
Provide modern TrackingFileManager
05a7cef
@cstamas cstamas mentioned this pull request Mar 24, 2026
Fix for good DefaultTrackingFileManager #1800 #1812
Closed
cstamas added 2 commits March 24, 2026 13:58
@cstamas
Add javadoc
0f474c9
@cstamas
Add system-wide locks
a1d7606
Move the out from "session scope" into "system scope"
@cstamas
cstamas requested review from kwin and slawekjaranowski March 24, 2026 14:26
@cstamas cstamas self-assigned this Mar 24, 2026
@cstamas
cstamas requested a review from gnodet March 24, 2026 14:28
cstamas added 2 commits March 24, 2026 15:50
@cstamas
Make provider work as expected.
db181bb
@cstamas
Shutdown only used locks
cbdcaf8
@cstamas
cstamas marked this pull request as ready for review March 25, 2026 15:55
gnodet
gnodet reviewed Mar 27, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code on behalf of Guillaume Nodet

Overall the refactoring to decouple NamedLockFactory lifecycle from the session scope is well-motivated and clean. Extracting DefaultNamedLockFactorySelector to manage lock factory selection system-wide (rather than per-session in NamedLockFactoryAdapterFactoryImpl) is the right move, and the "only shutdown used factories" semantic is a clear improvement. The NamedLocksTrackingFileManager itself is straightforward and well-structured.

I have a few concerns, grouped roughly by severity:

Category Count Key Items
Bug 2 Error message typo/wrong key; silent null/false on lock timeout
Design 3 Config key naming inconsistency; System.getProperties() safety; removed public constants
Minor 3 Javadoc typo; canonicalPath NPE risk; test-only coverage of in-JVM locks

The most important issue is the inconsistent lock-timeout behavior in NamedLocksTrackingFileManager: update() correctly throws on timeout, but read() and delete() silently return null/false, which is indistinguishable from "file does not exist" per the TrackingFileManager contract.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread maven-resolver-impl/src/main/java/org/eclipse/aether/impl/NamedLockFactorySelector.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...olver-impl/src/main/java/org/eclipse/aether/internal/impl/NamedLocksTrackingFileManager.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...olver-impl/src/main/java/org/eclipse/aether/internal/impl/NamedLocksTrackingFileManager.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...pl/src/main/java/org/eclipse/aether/internal/impl/named/DefaultNamedLockFactorySelector.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...pl/src/main/java/org/eclipse/aether/internal/impl/named/DefaultNamedLockFactorySelector.java
* @configurationType {@link java.lang.String}
* @configurationDefaultValue {@link #DEFAULT_LOCK_WAIT_TIME_UNIT}
*/
public static final String CONFIG_PROP_LOCK_WAIT_TIME_UNIT = CONFIG_PROPS_PREFIX + "timeUnit";

@gnodet gnodet Mar 27, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: naming inconsistency. The existing (now deprecated) key uses dot-separated time.unit (aether.syncContext.named.time.unit), and the companion time key here also uses dots (aether.system.named.time). But this new key uses camelCase: aether.system.named.timeUnit.

Consider time.unit for consistency:

Suggested change
public static final String CONFIG_PROP_LOCK_WAIT_TIME_UNIT = CONFIG_PROPS_PREFIX + "timeUnit";
public static final String CONFIG_PROP_LOCK_WAIT_TIME_UNIT = CONFIG_PROPS_PREFIX + "time.unit";

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@cstamas cstamas Mar 27, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always hated my initial choice: aether.syncContext.named.time.unit and aether.syncContext.named.time. The .unit makes time look like an object (and not scalar) and unit be some property of it.... Also, these are totally new keys (prefix is different, is not aether.syncContext...).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...esolver-impl/src/main/java/org/eclipse/aether/internal/impl/TrackingFileManagerProvider.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...rc/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapter.java
* @deprecated
*/
@Deprecated
public static final String CONFIG_PROP_TIME = CONFIG_PROPS_PREFIX + "time";

@gnodet gnodet Mar 27, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: DEFAULT_TIME and DEFAULT_TIME_UNIT (previously at this location) were public static final constants. Removing them is a binary-incompatible change for any downstream code that referenced NamedLockFactoryAdapter.DEFAULT_TIME or NamedLockFactoryAdapter.DEFAULT_TIME_UNIT.

The config property strings (CONFIG_PROP_TIME, CONFIG_PROP_TIME_UNIT) are correctly deprecated rather than removed. Consider giving the same treatment to the default-value constants — deprecate and keep them, pointing to DefaultNamedLockFactorySelector.DEFAULT_LOCK_WAIT_TIME etc.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cstamas reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread ...r-impl/src/test/java/org/eclipse/aether/internal/impl/NamedLocksTrackingFileManagerTest.java Outdated
public class NamedLocksTrackingFileManagerTest extends TrackingFileManagerTestSupport {
@Override
protected TrackingFileManager createTrackingFileManager(FS fs) {
return new NamedLocksTrackingFileManager(new LocalReadWriteLockNamedLockFactory(), 1L, TimeUnit.SECONDS);

@gnodet gnodet Mar 27, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test uses LocalReadWriteLockNamedLockFactory (JVM-local ReentrantReadWriteLock). Since the production default is FileLockNamedLockFactory (file-lock), the inter-process locking path is untested. Consider adding a parallel test class (or parameterization) with FileLockNamedLockFactory for the DEFAULT filesystem case.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cstamas reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread ...olver-impl/src/main/java/org/eclipse/aether/internal/impl/NamedLocksTrackingFileManager.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

cstamas and others added 9 commits March 27, 2026 13:03
@cstamas @gnodet
Update maven-resolver-impl/src/main/java/org/eclipse/aether/impl/Name…
99c857c
…dLockFactorySelector.java

Co-authored-by: Guillaume Nodet <[email protected]>
@cstamas @gnodet
Update maven-resolver-impl/src/main/java/org/eclipse/aether/internal/…
0aa4da5
…impl/NamedLocksTrackingFileManager.java

Co-authored-by: Guillaume Nodet <[email protected]>
@cstamas @gnodet
Update maven-resolver-impl/src/main/java/org/eclipse/aether/internal/…
2df017a
…impl/NamedLocksTrackingFileManager.java

Co-authored-by: Guillaume Nodet <[email protected]>
@cstamas @gnodet
Update maven-resolver-impl/src/main/java/org/eclipse/aether/internal/…
654df0a
…impl/named/DefaultNamedLockFactorySelector.java

Co-authored-by: Guillaume Nodet <[email protected]>
@cstamas @gnodet
Update maven-resolver-impl/src/main/java/org/eclipse/aether/internal/…
08bfdc5
…impl/TrackingFileManagerProvider.java

Co-authored-by: Guillaume Nodet <[email protected]>
@cstamas @gnodet
Update maven-resolver-impl/src/main/java/org/eclipse/aether/internal/…
8df995a
…impl/NamedLocksTrackingFileManager.java

Co-authored-by: Guillaume Nodet <[email protected]>
@cstamas
Drop unused
10f278d
@cstamas
Apply comment and undo Claude wrong changes
9626d92
@cstamas
Align semantic and behaviour everywhere
190daea
gnodet
gnodet approved these changes Mar 27, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code on behalf of Guillaume Nodet

All the issues from the previous review have been addressed:

  • Lock timeout behavior: read(), update(), and delete() now all consistently throw IllegalStateException on lock timeout. The Files.isReadable() pre-check was removed in favor of handling NoSuchFileException inside the lock — this is actually better than my original suggestion as it also eliminates the TOCTOU race.
  • Error message: fixed typo and corrected config key reference.
  • Javadoc: grammar fixed.
  • System.getProperties() safety: now uses stringPropertyNames() snapshot.
  • DEFAULT_TIME / DEFAULT_TIME_UNIT: restored as @Deprecated, delegating to DefaultNamedLockFactorySelector — preserves binary compatibility.
  • canonicalPath null guard: added.
  • update() parent null guard: bonus defensive fix.

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
cstamas added 2 commits March 27, 2026 14:27
@cstamas
Use FS lock factory
91cdaf1
@cstamas
Merge remote-tracking branch 'upstream/master' into tfm-named-locks
5e0d3ce
@cstamas
cstamas merged commit 4ab6c59 into apache:master Mar 27, 2026
13 of 14 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Mar 27, 2026

Copy link
Copy Markdown

@cstamas Please assign appropriate label to PR according to the type of change.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added this to the 2.0.17 milestone Mar 27, 2026
@cstamas
cstamas deleted the tfm-named-locks branch March 27, 2026 14:34
@cstamas cstamas added the enhancement New feature or request label Mar 27, 2026
@cstamas cstamas mentioned this pull request Mar 27, 2026
Fix for good DefaultTrackingFileManager #1800
Closed
@mkoncek mkoncek mentioned this pull request May 4, 2026
Missing javax.inject.Provider from TrackingFileManagerProvider #1858
Closed
@cstamas cstamas mentioned this pull request May 4, 2026
Fix: Remove javax.inject dependency #1859
Merged
cstamas added a commit that referenced this pull request May 8, 2026
@cstamas
Fix: Remove javax.inject dependency (#1859)
14c6bc5
As it was wrongly introduced in PM #1814. Core of resolver object graph declares javax.inject as optional, but the mentioned PR made it mandatory.

Fixes #1858
@slachiewicz slachiewicz mentioned this pull request Aug 31, 2026
[MRESOLVER-216] [ERROR] Malformed \uxxxx encoding. #1375
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gnodet gnodet gnodet approved these changes
@kwin kwin Awaiting requested review from kwin
@slawekjaranowski slawekjaranowski Awaiting requested review from slawekjaranowski

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@cstamas cstamas

Labels

enhancement New feature or request

Projects

None yet

Milestone

2.0.17

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@cstamas @gnodet
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.