8304833: (fc) Remove dead code in sun.nio.ch.FileChannelImpl::implCloseChannel
Reviewed-by: alanb
This commit is contained in:
parent
f96aee7401
commit
9a8a60f7d6
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
package sun.nio.ch;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
@ -79,7 +80,7 @@ public class FileChannelImpl
|
||||
private final boolean readable;
|
||||
|
||||
// Required to prevent finalization of creating stream (immutable)
|
||||
private final Object parent;
|
||||
private final Closeable parent;
|
||||
|
||||
// The path of the referenced file
|
||||
// (null if the parent stream is created with a file descriptor)
|
||||
@ -121,7 +122,7 @@ public class FileChannelImpl
|
||||
}
|
||||
|
||||
private FileChannelImpl(FileDescriptor fd, String path, boolean readable,
|
||||
boolean writable, boolean direct, Object parent)
|
||||
boolean writable, boolean direct, Closeable parent)
|
||||
{
|
||||
this.fd = fd;
|
||||
this.path = path;
|
||||
@ -149,7 +150,7 @@ public class FileChannelImpl
|
||||
// and RandomAccessFile::getChannel
|
||||
public static FileChannel open(FileDescriptor fd, String path,
|
||||
boolean readable, boolean writable,
|
||||
boolean direct, Object parent)
|
||||
boolean direct, Closeable parent)
|
||||
{
|
||||
return new FileChannelImpl(fd, path, readable, writable, direct, parent);
|
||||
}
|
||||
@ -193,25 +194,24 @@ public class FileChannelImpl
|
||||
threads.signalAndWait();
|
||||
|
||||
if (parent != null) {
|
||||
|
||||
//
|
||||
// Close the fd via the parent stream's close method. The parent
|
||||
// will reinvoke our close method, which is defined in the
|
||||
// superclass AbstractInterruptibleChannel, but the isOpen logic in
|
||||
// that method will prevent this method from being reinvoked.
|
||||
//
|
||||
((java.io.Closeable)parent).close();
|
||||
} else if (closer != null) {
|
||||
parent.close();
|
||||
} else { // parent == null hence closer != null
|
||||
//
|
||||
// Perform the cleaning action so it is not redone when
|
||||
// this channel becomes phantom reachable.
|
||||
//
|
||||
try {
|
||||
closer.clean();
|
||||
} catch (UncheckedIOException uioe) {
|
||||
throw uioe.getCause();
|
||||
}
|
||||
} else {
|
||||
fdAccess.close(fd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int read(ByteBuffer dst) throws IOException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user