chibenwa commented on code in PR #1824:
URL: https://github.com/apache/james-project/pull/1824#discussion_r1422345790


##########
server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java:
##########
@@ -160,6 +168,22 @@ private ImapPackage retrievePackages(GuiceGenericLoader 
loader, HierarchicalConf
         return ImapPackage.and(packages);
     }
 
+    private Set<ConnectionCheck> retrieveConnectionChecks(GuiceGenericLoader 
loader, HierarchicalConfiguration<ImmutableNode> configuration) {
+        String[] connectionChecks = 
configuration.getStringArray("additionalConnectionCheck");
+
+        return Optional.ofNullable(connectionChecks)
+            .stream()
+            .flatMap(Arrays::stream)
+            .map(ClassName::new)
+            .map(Throwing.function(loader::instantiate))
+            .map(ConnectionCheck.class::cast)
+            .collect(ImmutableSet.toImmutableSet());
+    }
+
+    private ThrowingFunction<HierarchicalConfiguration<ImmutableNode>, 
Set<ConnectionCheck>> retrieveConnectionChecks(GuiceGenericLoader loader) {
+        return configuration -> retrieveConnectionChecks(loader, 
configuration);
+    }

Review Comment:
   -> Merge in one method and inject `ConnectionCheckFactory` instead...



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to