chenqin commented on a change in pull request #15442: URL: https://github.com/apache/flink/pull/15442#discussion_r605697498
########## File path: flink-core/src/main/java/org/apache/flink/core/fs/EntropyInjector.java ########## @@ -93,25 +93,18 @@ public static boolean isEntropyInjecting(FileSystem fs) { @Nullable private static EntropyInjectingFileSystem getEntropyFs(FileSystem fs) { - if (fs instanceof EntropyInjectingFileSystem) { - return (EntropyInjectingFileSystem) fs; - } else if (fs instanceof SafetyNetWrapperFileSystem) { + if (fs instanceof SafetyNetWrapperFileSystem) { FileSystem delegate = ((SafetyNetWrapperFileSystem) fs).getWrappedDelegate(); - if (delegate instanceof EntropyInjectingFileSystem) { - return (EntropyInjectingFileSystem) delegate; - } else if (delegate instanceof PluginFileSystemFactory.ClassLoaderFixingFileSystem) { - FileSystem innerFs = - ((PluginFileSystemFactory.ClassLoaderFixingFileSystem) delegate).getInner(); - if (innerFs instanceof EntropyInjectingFileSystem) { - return (EntropyInjectingFileSystem) innerFs; - } - return null; - } else { - return null; - } - } else { - return null; + return getEntropyFs(delegate); } + + if (fs instanceof PluginFileSystemFactory.ClassLoaderFixingFileSystem) { + FileSystem innerFs = + ((PluginFileSystemFactory.ClassLoaderFixingFileSystem) fs).getWrappedDelegate(); + return getEntropyFs(innerFs); + } Review comment: Thanks for detailed comment. just updated pr per suggestion. It's cleaner implementation and future proof for Matryoshka doll like filesystem wrappers. -- 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: us...@infra.apache.org