< prev index next >

src/java.base/windows/classes/sun/nio/fs/DefaultFileSystemProvider.java

Print this page
8213406: (fs) More than one instance of built-in FileSystem observed in heap
Reviewed-by: alanb, cushon, weijun

*** 1,7 **** /* ! * Copyright (c) 2008, 2009, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 23,38 **** * questions. */ package sun.nio.fs; ! import java.nio.file.spi.FileSystemProvider; /** ! * Creates default provider on Windows */ public class DefaultFileSystemProvider { private DefaultFileSystemProvider() { } ! public static FileSystemProvider create() { ! return new WindowsFileSystemProvider(); } } --- 23,52 ---- * questions. */ package sun.nio.fs; ! import java.nio.file.FileSystem; /** ! * Creates this platform's default FileSystemProvider. */ public class DefaultFileSystemProvider { + private static final WindowsFileSystemProvider INSTANCE + = new WindowsFileSystemProvider(); + private DefaultFileSystemProvider() { } ! ! /** ! * 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(); } }
< prev index next >