Class WindowCache.StrongRef
java.lang.Object
org.eclipse.jgit.internal.storage.file.WindowCache.StrongRef
- All Implemented Interfaces:
WindowCache.PageRef<ByteWindow>
- Enclosing class:
- WindowCache
private static class WindowCache.StrongRef
extends Object
implements WindowCache.PageRef<ByteWindow>
A strong reference wrapped around a cached object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate final Packprivate final longprivate WindowCache.CleanupQueueprivate ByteWindowprivate final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStrongRef(Pack pack, long position, ByteWindow v, WindowCache.CleanupQueue queue) -
Method Summary
Modifier and TypeMethodDescriptionget()Returns this reference object's referent.longGet pseudo time of last access to this cache pagegetPack()Get thePackthe referenced cache page is allocated forlongGet the position of the referenced cache page in thePackintgetSize()Get size of cache pagebooleanWhether this is a strong reference.booleankill()Kill this refvoidsetLastAccess(long time) Set pseudo time of last access to this cache page
-
Field Details
-
referent
-
pack
-
position
private final long position -
size
private final int size -
lastAccess
private long lastAccess -
queue
-
-
Constructor Details
-
StrongRef
-
-
Method Details
-
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
-
get
Description copied from interface:WindowCache.PageRefReturns this reference object's referent. If this reference object has been cleared, either by the program or by the garbage collector, then this method returnsnull.- Specified by:
getin interfaceWindowCache.PageRef<ByteWindow>- Returns:
- The object to which this reference refers, or
nullif this reference object has been cleared
-
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
-