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 longlastAccessprivate Packpackprivate longpositionprivate intsize
-
Constructor Summary
Constructors Modifier Constructor Description protectedSoftRef(Pack pack, long position, ByteWindow v, WindowCache.SoftCleanupQueue queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetLastAccess()Get pseudo time of last access to this cache pagePackgetPack()Get thePackthe referenced cache page is allocated forlonggetPosition()Get the position of the referenced cache page in thePackintgetSize()Get size of cache pagebooleanisStrongRef()Whether this is a strong reference.booleankill()Kill this refvoidsetLastAccess(long time)Set pseudo time of last access to this cache page-
Methods inherited from class java.lang.Object
clone, 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 Pack pack
-
position
private final long position
-
size
private final int size
-
lastAccess
private long lastAccess
-
-
Constructor Detail
-
SoftRef
protected SoftRef(Pack pack, long position, ByteWindow v, WindowCache.SoftCleanupQueue queue)
-
-
Method Detail
-
getPack
public Pack getPack()
Description copied from interface:WindowCache.PageRefGet thePackthe referenced cache page is allocated for- Specified by:
getPackin interfaceWindowCache.PageRef<ByteWindow>- Returns:
- the
Packthe referenced cache page is allocated for
-
getPosition
public long getPosition()
Description copied from interface:WindowCache.PageRefGet the position of the referenced cache page in thePack- Specified by:
getPositionin interfaceWindowCache.PageRef<ByteWindow>- Returns:
- the position of the referenced cache page in the
Pack
-
getSize
public int getSize()
Description copied from interface:WindowCache.PageRefGet size of cache page- Specified by:
getSizein interfaceWindowCache.PageRef<ByteWindow>- Returns:
- size of cache page
-
getLastAccess
public long getLastAccess()
Description copied from interface:WindowCache.PageRefGet pseudo time of last access to this cache page- Specified by:
getLastAccessin interfaceWindowCache.PageRef<ByteWindow>- Returns:
- pseudo time of last access to this cache page
-
setLastAccess
public void setLastAccess(long time)
Description copied from interface:WindowCache.PageRefSet pseudo time of last access to this cache page- Specified by:
setLastAccessin interfaceWindowCache.PageRef<ByteWindow>- Parameters:
time- pseudo time of last access to this cache page
-
kill
public boolean kill()
Description copied from interface:WindowCache.PageRefKill this ref- Specified by:
killin interfaceWindowCache.PageRef<ByteWindow>- Returns:
trueif this reference object was successfully killed;falseif it was already killed
-
isStrongRef
public boolean isStrongRef()
Description copied from interface:WindowCache.PageRefWhether this is a strong reference.- Specified by:
isStrongRefin interfaceWindowCache.PageRef<ByteWindow>- Returns:
trueif this is a strong reference
-
-