mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
IJPL-161551 IJ-CR-144280 Avoid excessive memory barrier in BasicFileAttributesHolder2.Impl
GitOrigin-RevId: c92e73a2acd82f077fbf733d789bbce5ac16a878
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2a88042525
commit
a9e495c158
@@ -39,7 +39,11 @@ public interface BasicFileAttributesHolder2 extends BasicFileAttributesHolder {
|
||||
* however strange the original works, this implementation should work the same.
|
||||
* </p>
|
||||
*/
|
||||
protected volatile @NotNull WeakReference<@Nullable BasicFileAttributes> myCachedAttributes = new WeakReference<>(null);
|
||||
protected final @NotNull WeakReference<@Nullable BasicFileAttributes> myCachedAttributes;
|
||||
|
||||
protected Impl(@Nullable BasicFileAttributes attributes) {
|
||||
myCachedAttributes = new WeakReference<>(attributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicFileAttributes get() {
|
||||
|
||||
@@ -21,17 +21,13 @@ class IjentNioPath internal constructor(
|
||||
val ijentPath: IjentPath,
|
||||
internal val nioFs: IjentNioFileSystem,
|
||||
cachedAttributes: BasicFileAttributes?,
|
||||
) : Path, BasicFileAttributesHolder2.Impl() {
|
||||
) : Path, BasicFileAttributesHolder2.Impl(cachedAttributes) {
|
||||
private val isWindows
|
||||
get() = when (nioFs.ijentFs) {
|
||||
is IjentFileSystemPosixApi -> false
|
||||
is IjentFileSystemWindowsApi -> true
|
||||
}
|
||||
|
||||
init {
|
||||
myCachedAttributes = WeakReference(cachedAttributes)
|
||||
}
|
||||
|
||||
override fun getFileSystem(): IjentNioFileSystem = nioFs
|
||||
|
||||
override fun isAbsolute(): Boolean =
|
||||
|
||||
@@ -2,23 +2,14 @@
|
||||
package com.intellij.execution.wsl.ijent.nio
|
||||
|
||||
import com.intellij.platform.core.nio.fs.BasicFileAttributesHolder2
|
||||
import java.lang.ref.WeakReference
|
||||
import java.net.URI
|
||||
import java.nio.file.LinkOption
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.WatchEvent
|
||||
import java.nio.file.WatchKey
|
||||
import java.nio.file.WatchService
|
||||
import java.nio.file.*
|
||||
|
||||
class IjentWslNioPath(
|
||||
private val fileSystem: IjentWslNioFileSystem,
|
||||
val delegate: Path,
|
||||
cachedAttributes: IjentNioPosixFileAttributesWithDosAdapter?,
|
||||
) : Path, BasicFileAttributesHolder2.Impl() {
|
||||
init {
|
||||
myCachedAttributes = WeakReference(cachedAttributes)
|
||||
}
|
||||
|
||||
) : Path, BasicFileAttributesHolder2.Impl(cachedAttributes) {
|
||||
override fun getFileSystem(): IjentWslNioFileSystem = fileSystem
|
||||
|
||||
override fun isAbsolute(): Boolean = delegate.isAbsolute
|
||||
|
||||
Reference in New Issue
Block a user