8189209: java/lang/invoke/lambda/LambdaAsm.java failed with "could not create proxy classes"
Use an inner class for the closer instead of a lambda Reviewed-by: alanb, rriggs
This commit is contained in:
parent
81b7f75837
commit
848a4d9bae
@ -90,6 +90,18 @@ public class FileChannelImpl
|
|||||||
// Cleanable with an action which closes this channel's file descriptor
|
// Cleanable with an action which closes this channel's file descriptor
|
||||||
private final Cleanable closer;
|
private final Cleanable closer;
|
||||||
|
|
||||||
|
private static class Closer implements Runnable {
|
||||||
|
private final FileDescriptor fd;
|
||||||
|
|
||||||
|
Closer(FileDescriptor fd) {
|
||||||
|
this.fd = fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
fdAccess.close(fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private FileChannelImpl(FileDescriptor fd, String path, boolean readable,
|
private FileChannelImpl(FileDescriptor fd, String path, boolean readable,
|
||||||
boolean writable, Object parent)
|
boolean writable, Object parent)
|
||||||
{
|
{
|
||||||
@ -101,8 +113,10 @@ public class FileChannelImpl
|
|||||||
this.nd = new FileDispatcherImpl();
|
this.nd = new FileDispatcherImpl();
|
||||||
// Register a cleaning action if and only if there is no parent
|
// Register a cleaning action if and only if there is no parent
|
||||||
// as the parent will take care of closing the file descriptor.
|
// as the parent will take care of closing the file descriptor.
|
||||||
this.closer= parent != null ? null :
|
// FileChannel is used by the LambdaMetaFactory so a lambda cannot
|
||||||
CleanerFactory.cleaner().register(this, () -> fdAccess.close(fd));
|
// be used here hence we use a nested class instead.
|
||||||
|
this.closer = parent != null ? null :
|
||||||
|
CleanerFactory.cleaner().register(this, new Closer(fd));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used by FileInputStream.getChannel(), FileOutputStream.getChannel
|
// Used by FileInputStream.getChannel(), FileOutputStream.getChannel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user