AHeise commented on a change in pull request #15442:
URL: https://github.com/apache/flink/pull/15442#discussion_r605399943
##########
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:
We can reduce both cases to check `if (fs instanceof WrappingProxy)` now
and have it kind of future proof for future wrappers. I'd probably have the
`EntropyInjectingFileSystem` check first (as it used to be) in case that some
implementation will be both `EntropyInjectingFileSystem` and `WrappingProxy`.
--
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:
[email protected]