提交 2d647151 编写于 作者: T tedyu 提交者: Stephan Ewen

[FLINK-2866] [runtime] Eagerly close FSDataInputStream in file state handle

This closes #1282
上级 fa88d9eb
......@@ -46,8 +46,9 @@ public class FileSerializableStateHandle<T> extends AbstractFileState implements
@Override
@SuppressWarnings("unchecked")
public T getState(ClassLoader classLoader) throws Exception {
FSDataInputStream inStream = getFileSystem().open(getFilePath());
ObjectInputStream ois = new InstantiationUtil.ClassLoaderObjectInputStream(inStream, classLoader);
return (T) ois.readObject();
try (FSDataInputStream inStream = getFileSystem().open(getFilePath())) {
ObjectInputStream ois = new InstantiationUtil.ClassLoaderObjectInputStream(inStream, classLoader);
return (T) ois.readObject();
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册