rkhachatryan commented on code in PR #21679:
URL: https://github.com/apache/flink/pull/21679#discussion_r1101557635
##########
flink-dstl/flink-dstl-dfs/src/main/java/org/apache/flink/changelog/fs/ChangelogStreamHandleReaderWithCache.java:
##########
@@ -161,23 +161,28 @@ private FileInputStream openAndSeek(RefCountedFile
refCountedFile, long offset)
private DataInputStream wrapStream(Path dfsPath, FileInputStream fin) {
return new DataInputStream(new BufferedInputStream(fin)) {
+ private boolean closed = false;
+
@Override
public void close() throws IOException {
- try {
- super.close();
- } finally {
- cache.computeIfPresent(
- dfsPath,
- (key, value) -> {
- value.release();
- if (value.getReferenceCounter() ==
NO_USING_REF_COUNT) {
- cacheCleanScheduler.schedule(
- () -> cleanCacheFile(dfsPath),
- cacheIdleMillis,
- TimeUnit.MILLISECONDS);
- }
- return value;
- });
+ if (!closed) {
+ closed = true;
Review Comment:
Yes, you're right, thanks for the correction
(I've also checked whether it can be closed by a non-task thread (e.g.
watchdog), but that's not the case).
--
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]