You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2022/08/19 17:17:01 UTC

[GitHub] [knox] MrtnBalazs commented on a diff in pull request #620: Knox 2788 - Implementing EmptyVerifier and Cleaning background thread

MrtnBalazs commented on code in PR #620:
URL: https://github.com/apache/knox/pull/620#discussion_r950412847


##########
gateway-server/src/main/java/org/apache/knox/gateway/services/factory/ConcurrentSessionVerifierFactory.java:
##########
@@ -17,21 +17,37 @@
  */
 package org.apache.knox.gateway.services.factory;
 
+import static java.util.Arrays.asList;
+import static java.util.Collections.unmodifiableList;
+
+import java.util.Collection;
+import java.util.Map;
+
 import org.apache.knox.gateway.config.GatewayConfig;
 import org.apache.knox.gateway.services.GatewayServices;
 import org.apache.knox.gateway.services.Service;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.gateway.services.ServiceType;
+import org.apache.knox.gateway.session.control.EmptyConcurrentSessionVerifier;
 import org.apache.knox.gateway.session.control.InMemoryConcurrentSessionVerifier;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
 public class ConcurrentSessionVerifierFactory extends AbstractServiceFactory {
   @Override
   protected Service createService(GatewayServices gatewayServices, ServiceType serviceType, GatewayConfig gatewayConfig, Map<String, String> options, String implementation) throws ServiceLifecycleException {
-    return shouldCreateService(implementation) ? new InMemoryConcurrentSessionVerifier() : null;
+    Service service = null;
+    if (shouldCreateService(implementation)) {

Review Comment:
   As far as i can see, it is impossible to add null as a service. When we add the service with the `addService` method of `AbstractGatewayServices` class a `NullPointerException` is thrown by these lines:
   ```
   // Ensure the service is not null
   if (service == null) {
      throw new NullPointerException("A null service may not be added.");
   }
   ```



-- 
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: dev-unsubscribe@knox.apache.org

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