You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/12/22 11:11:23 UTC

[GitHub] [maven] michael-o commented on a change in pull request #621: [MNG-7347] SessionScoped beans should be singletons for a given session

michael-o commented on a change in pull request #621:
URL: https://github.com/apache/maven/pull/621#discussion_r773804726



##########
File path: maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java
##########
@@ -89,8 +89,12 @@ public void buildProject( MavenSession session, MavenSession rootSession, Reacto
 
         // session may be different from rootSession seeded in DefaultMaven
         // explicitly seed the right session here to make sure it is used by Guice
-        sessionScope.enter( reactorContext.getSessionScopeMemento() );

Review comment:
       I have no idea what `getSessionScopeMemento()`, but can you explain why it is not required anymore?

##########
File path: maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java
##########
@@ -73,11 +68,4 @@ public ClassLoader getOriginalContextClassLoader()
         return originalContextClassLoader;
     }
 
-    /**
-     * @since 3.3.0
-     */
-    public SessionScope.Memento getSessionScopeMemento()

Review comment:
       This should rather be deprecated in 3.9.0 and removed in 4.0, no?

##########
File path: maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java
##########
@@ -89,8 +89,12 @@ public void buildProject( MavenSession session, MavenSession rootSession, Reacto
 
         // session may be different from rootSession seeded in DefaultMaven
         // explicitly seed the right session here to make sure it is used by Guice
-        sessionScope.enter( reactorContext.getSessionScopeMemento() );
-        sessionScope.seed( MavenSession.class, session );
+        final boolean scoped = session != rootSession;

Review comment:
       Is reference comparison acceptable here?

##########
File path: maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java
##########
@@ -19,35 +19,23 @@
  * under the License.
  */
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
+import java.util.Collection;
+import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 import com.google.inject.Key;
 import com.google.inject.OutOfScopeException;
 import com.google.inject.Provider;
 import com.google.inject.Scope;
-import com.google.inject.util.Providers;
 
 /**
  * SessionScope
  */
 public class SessionScope
-    implements Scope
+        implements Scope
 {
-    /**
-     * @since 3.3.0
-     */
-    public static class Memento

Review comment:
       Same here




-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org