Class WindowCache.SoftRef
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.SoftReference<ByteWindow>
-
- org.eclipse.jgit.internal.storage.file.WindowCache.SoftRef
-
- All Implemented Interfaces:
WindowCache.PageRef<ByteWindow>
- Enclosing class:
- WindowCache
private static class WindowCache.SoftRef extends java.lang.ref.SoftReference<ByteWindow> implements WindowCache.PageRef<ByteWindow>
A soft reference wrapped around a cached object.
-
-
Field Summary
Fields Modifier and Type Field Description private long
lastAccess
private PackFile
pack
private long
position
private int
size
-
Constructor Summary
Constructors Modifier Constructor Description protected
SoftRef(PackFile pack, long position, ByteWindow v, WindowCache.SoftCleanupQueue queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getLastAccess()
Get pseudo time of last access to this cache pagePackFile
getPack()
Get the packfile the referenced cache page is allocated forlong
getPosition()
Get the position of the referenced cache page in the packfileint
getSize()
Get size of cache pageboolean
isStrongRef()
Whether this is a strong reference.boolean
kill()
Kill this refvoid
setLastAccess(long time)
Set pseudo time of last access to this cache page-
Methods inherited from class java.lang.ref.Reference
clear, clone, enqueue, isEnqueued, reachabilityFence
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.jgit.internal.storage.file.WindowCache.PageRef
get
-
-
-
-
Field Detail
-
pack
private final PackFile pack
-
position
private final long position
-
size
private final int size
-
lastAccess
private long lastAccess
-
-
Constructor Detail
-
SoftRef
protected SoftRef(PackFile pack, long position, ByteWindow v, WindowCache.SoftCleanupQueue queue)
-
-
Method Detail
-
getPack
public PackFile getPack()
Description copied from interface:WindowCache.PageRef
Get the packfile the referenced cache page is allocated for- Specified by:
getPack
in interfaceWindowCache.PageRef<ByteWindow>
- Returns:
- the packfile the referenced cache page is allocated for
-
getPosition
public long getPosition()
Description copied from interface:WindowCache.PageRef
Get the position of the referenced cache page in the packfile- Specified by:
getPosition
in interfaceWindowCache.PageRef<ByteWindow>
- Returns:
- the position of the referenced cache page in the packfile
-
getSize
public int getSize()
Description copied from interface:WindowCache.PageRef
Get size of cache page- Specified by:
getSize
in interfaceWindowCache.PageRef<ByteWindow>
- Returns:
- size of cache page
-
getLastAccess
public long getLastAccess()
Description copied from interface:WindowCache.PageRef
Get pseudo time of last access to this cache page- Specified by:
getLastAccess
in interfaceWindowCache.PageRef<ByteWindow>
- Returns:
- pseudo time of last access to this cache page
-
setLastAccess
public void setLastAccess(long time)
Description copied from interface:WindowCache.PageRef
Set pseudo time of last access to this cache page- Specified by:
setLastAccess
in interfaceWindowCache.PageRef<ByteWindow>
- Parameters:
time
- pseudo time of last access to this cache page
-
kill
public boolean kill()
Description copied from interface:WindowCache.PageRef
Kill this ref- Specified by:
kill
in interfaceWindowCache.PageRef<ByteWindow>
- Returns:
true
if this reference object was successfully killed;false
if it was already killed
-
isStrongRef
public boolean isStrongRef()
Description copied from interface:WindowCache.PageRef
Whether this is a strong reference.- Specified by:
isStrongRef
in interfaceWindowCache.PageRef<ByteWindow>
- Returns:
true
if this is a strong reference
-
-