michael-o commented on code in PR #276:
URL: https://github.com/apache/maven-resolver/pull/276#discussion_r1158323839
##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactoryAdapter.java:
##########
@@ -130,47 +151,78 @@ private TimeUnit getTimeUnit(final
RepositorySystemSession session) {
return TimeUnit.valueOf(ConfigUtils.getString(session,
DEFAULT_TIME_UNIT.name(), TIME_UNIT_KEY));
}
+ private int getRetry(final RepositorySystemSession session) {
+ return ConfigUtils.getInteger(session, DEFAULT_RETRY, RETRY_KEY);
+ }
+
+ private long getRetryWait(final RepositorySystemSession session) {
+ return ConfigUtils.getLong(session, DEFAULT_RETRY_WAIT,
RETRY_WAIT_KEY);
+ }
+
@Override
public void acquire(Collection<? extends Artifact> artifacts,
Collection<? extends Metadata> metadatas) {
Collection<String> keys = lockNaming.nameLocks(session, artifacts,
metadatas);
if (keys.isEmpty()) {
return;
}
- LOGGER.trace("Need {} {} lock(s) for {}", keys.size(), shared ?
"read" : "write", keys);
- int acquiredLockCount = 0;
- for (String key : keys) {
- NamedLock namedLock = namedLockFactory.getLock(key);
+ final int attempts = retry + 1;
+ final ArrayList<IllegalStateException> illegalStateExceptions =
new ArrayList<>();
+ for (int attempt = 1; attempt <= attempts; attempt++) {
Review Comment:
This looks much better now!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]