mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8213406: (fs) More than one instance of built-in FileSystem observed in heap
Reviewed-by: alanb, cushon, weijun
This commit is contained in:
parent
978c78f7fc
commit
7212bf0a77
14 changed files with 106 additions and 53 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, 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,14 +25,28 @@
|
|||
|
||||
package sun.nio.fs;
|
||||
|
||||
import java.nio.file.spi.FileSystemProvider;
|
||||
import java.nio.file.FileSystem;
|
||||
|
||||
/**
|
||||
* Creates default provider on Windows
|
||||
* Creates this platform's default FileSystemProvider.
|
||||
*/
|
||||
public class DefaultFileSystemProvider {
|
||||
private static final WindowsFileSystemProvider INSTANCE
|
||||
= new WindowsFileSystemProvider();
|
||||
|
||||
private DefaultFileSystemProvider() { }
|
||||
public static FileSystemProvider create() {
|
||||
return new WindowsFileSystemProvider();
|
||||
|
||||
/**
|
||||
* Returns the platform's default file system provider.
|
||||
*/
|
||||
public static WindowsFileSystemProvider instance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the platform's default file system.
|
||||
*/
|
||||
public static FileSystem theFileSystem() {
|
||||
return INSTANCE.theFileSystem();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, 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
|
||||
|
@ -42,7 +42,7 @@ import static sun.nio.fs.WindowsNativeDispatcher.*;
|
|||
import static sun.nio.fs.WindowsSecurity.*;
|
||||
import static sun.nio.fs.WindowsConstants.*;
|
||||
|
||||
public class WindowsFileSystemProvider
|
||||
class WindowsFileSystemProvider
|
||||
extends AbstractFileSystemProvider
|
||||
{
|
||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
|
@ -53,6 +53,10 @@ public class WindowsFileSystemProvider
|
|||
theFileSystem = new WindowsFileSystem(this, StaticProperty.userDir());
|
||||
}
|
||||
|
||||
WindowsFileSystem theFileSystem() {
|
||||
return theFileSystem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScheme() {
|
||||
return "file";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue