[ 
https://issues.apache.org/jira/browse/MRESOLVER-302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17784114#comment-17784114
 ] 

ASF GitHub Bot commented on MRESOLVER-302:
------------------------------------------

kwin commented on code in PR #357:
URL: https://github.com/apache/maven-resolver/pull/357#discussion_r1386875573


##########
maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystem.java:
##########
@@ -304,8 +314,26 @@ List<RemoteRepository> newResolutionRepositories(
      * When shutdown happens, all the registered on-close handlers will be 
invoked (even if some throws), and at end
      * of operation a {@link MultiRuntimeException} may be thrown, signaling 
that some handler(s) failed. This exception
      * may be ignored, is at the discretion of caller.
+     * <p>
+     * Note: this method actually just calls {@link #close()}.
      *
      * @since 1.9.0
+     * @deprecated Use {@link #close()} instead.
      */
+    @Deprecated
     void shutdown();
+
+    /**
+     * Signals to repository system to shut down. Shut down instance is not 
usable anymore.
+     * <p>
+     * Repository system may perform some resource cleanup, if applicable. Not 
using this method may cause leaks or
+     * unclean shutdown of some subsystem.
+     * <p>
+     * When shutdown happens, all the registered on-close handlers will be 
invoked (even if some throws), and at end
+     * of operation a {@link MultiRuntimeException} may be thrown, signaling 
that some handler(s) failed. This exception
+     * may be ignored, is at the discretion of caller.
+     *
+     * @since TBD
+     */
+    void close();

Review Comment:
   What about a default implementation just calling shutdown()?



##########
maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java:
##########
@@ -48,6 +51,350 @@
  */
 public interface RepositorySystemSession {
 
+    /**
+     * Immutable session that is closeable, can have onClose handlers 
registered and should be handled as a resource.
+     * These session instances can be created with {@link SessionBuilder}.
+     *
+     * @since TBD
+     */
+    interface CloseableRepositorySystemSession extends 
RepositorySystemSession, Closeable {

Review Comment:
   why not making the `RepositorySystemSession` always implement `Closeable` 
with an empty default method `close()`



##########
maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystem.java:
##########
@@ -304,8 +314,26 @@ List<RemoteRepository> newResolutionRepositories(
      * When shutdown happens, all the registered on-close handlers will be 
invoked (even if some throws), and at end
      * of operation a {@link MultiRuntimeException} may be thrown, signaling 
that some handler(s) failed. This exception
      * may be ignored, is at the discretion of caller.
+     * <p>
+     * Note: this method actually just calls {@link #close()}.
      *
      * @since 1.9.0
+     * @deprecated Use {@link #close()} instead.
      */
+    @Deprecated
     void shutdown();
+
+    /**
+     * Signals to repository system to shut down. Shut down instance is not 
usable anymore.
+     * <p>
+     * Repository system may perform some resource cleanup, if applicable. Not 
using this method may cause leaks or
+     * unclean shutdown of some subsystem.
+     * <p>
+     * When shutdown happens, all the registered on-close handlers will be 
invoked (even if some throws), and at end
+     * of operation a {@link MultiRuntimeException} may be thrown, signaling 
that some handler(s) failed. This exception
+     * may be ignored, is at the discretion of caller.
+     *
+     * @since TBD
+     */

Review Comment:
   ```suggestion
        */
        @Override
   ```





> Introduce onSession close
> -------------------------
>
>                 Key: MRESOLVER-302
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-302
>             Project: Maven Resolver
>          Issue Type: Improvement
>          Components: Resolver
>            Reporter: Tamas Cservenak
>            Assignee: Tamas Cservenak
>            Priority: Major
>             Fix For: 2.0.0
>
>
> The on session close callback, revisited.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to