cstamas commented on code in PR #357:
URL: https://github.com/apache/maven-resolver/pull/357#discussion_r1386923270
##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultRepositorySystemLifecycle.java:
##########
@@ -69,6 +74,59 @@ public void addOnSystemEndedHandler(Runnable handler) {
onSystemEndedHandlers.add(0, handler);
}
+ @Override
+ public void sessionStarted(CloseableRepositorySystemSession session) {
+ requireNonNull(session, "session cannot be null");
+ requireNotShutdown();
+ String sessionId = session.sessionId();
+ onSessionEndedHandlers.compute(sessionId, (k, v) -> {
+ if (v != null) {
+ throw new IllegalStateException("session instance already
registered");
+ }
+ return new CopyOnWriteArrayList<>();
+ });
+ }
+
+ @Override
+ public void sessionEnded(CloseableRepositorySystemSession session) {
+ requireNonNull(session, "session cannot be null");
+ requireNotShutdown();
+ String sessionId = session.sessionId();
+ ArrayList<Runnable> handlers = new ArrayList<>();
+ onSessionEndedHandlers.compute(sessionId, (k, v) -> {
+ if (v == null) {
+ throw new IllegalStateException("session instance not
registered");
+ }
+ handlers.addAll(v);
Review Comment:
that would make `handlers` non-immutable, no? This is within lambda...
--
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]