flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] StefanRRichter commented on a change in pull request #8038: [FLINK-11953] Introduce Plugin/Loading system and integrate it with FileSystem
Date Tue, 09 Apr 2019 08:19:26 GMT
StefanRRichter commented on a change in pull request #8038: [FLINK-11953] Introduce Plugin/Loading
system and integrate it with FileSystem
URL: https://github.com/apache/flink/pull/8038#discussion_r273375359
 
 

 ##########
 File path: flink-core/src/main/java/org/apache/flink/core/plugin/DirectoryBasedPluginFinder.java
 ##########
 @@ -78,19 +78,17 @@ public DirectoryBasedPluginDescriptorsFactory(Path pluginsRootDir) {
 
 	private Optional<PluginDescriptor> createPluginDescriptorForSubDirectory(Path subDirectory)
{
 		Optional<URL[]> jarURLsFromDirectory = createJarURLsFromDirectory(subDirectory);
-		if (jarURLsFromDirectory.isPresent()) {
-			URL[] urls = jarURLsFromDirectory.get();
-			// we sort the urls for the benefit of having a stable/reproducible order of jars.
-			Arrays.sort(urls, Comparator.comparing(URL::toString));
-			//TODO: This class could be extended to parse exclude-pattern from a optional text files
in the plugin directories.
-			return Optional.of(
-				new PluginDescriptor(
-					subDirectory.getFileName().toString(),
-					urls,
-					new String[0]));
-		} else {
-			return Optional.empty();
-		}
+		return jarURLsFromDirectory
+			.map((URL[] urls) -> {
+				Arrays.sort(urls, Comparator.comparing(URL::toString));
+				//TODO: This class could be extended to parse exclude-pattern from a optional text files
in the plugin directories.
+				return Optional.of(
+					new PluginDescriptor(
+						subDirectory.getFileName().toString(),
+						urls,
+						new String[0]));
+			})
+			.orElse(Optional.empty());
 
 Review comment:
   I think you saw some outdated version, this was already removed :)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message