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 java.lang.Object implements WindowCache.PageRef<ByteWindow>
A strong reference wrapped around a cached object.
-
-
Field Summary
Fields Modifier and Type Field Description private longlastAccessprivate PackFilepackprivate longpositionprivate WindowCache.CleanupQueuequeueprivate ByteWindowreferentprivate intsize
-
Constructor Summary
Constructors Modifier Constructor Description protectedStrongRef(PackFile pack, long position, ByteWindow v, WindowCache.CleanupQueue queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteWindowget()Returns this reference object's referent.longgetLastAccess()Get pseudo time of last access to this cache pagePackFilegetPack()Get the packfile the referenced cache page is allocated forlonggetPosition()Get the position of the referenced cache page in the packfileintgetSize()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
-
-
-
Field Detail
-
referent
private ByteWindow referent
-
pack
private final PackFile pack
-
position
private final long position
-
size
private final int size
-
lastAccess
private long lastAccess
-
queue
private WindowCache.CleanupQueue queue
-
-
Constructor Detail
-
StrongRef
protected StrongRef(PackFile pack, long position, ByteWindow v, WindowCache.CleanupQueue queue)
-
-
Method Detail
-
getPack
public PackFile getPack()
Description copied from interface:WindowCache.PageRefGet the packfile the referenced cache page is allocated for- Specified by:
getPackin interfaceWindowCache.PageRef<ByteWindow>- Returns:
- the packfile the referenced cache page is allocated for
-
getPosition
public long getPosition()
Description copied from interface:WindowCache.PageRefGet the position of the referenced cache page in the packfile- Specified by:
getPositionin interfaceWindowCache.PageRef<ByteWindow>- Returns:
- the position of the referenced cache page in the packfile
-
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
public ByteWindow 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
-
-