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 long
private final Pack
private final long
private WindowCache.CleanupQueue
private ByteWindow
private final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
StrongRef
(Pack pack, long position, ByteWindow v, WindowCache.CleanupQueue queue) -
Method Summary
Modifier and TypeMethodDescriptionget()
Returns this reference object's referent.long
Get pseudo time of last access to this cache pagegetPack()
Get thePack
the referenced cache page is allocated forlong
Get the position of the referenced cache page in thePack
int
getSize()
Get size of cache pageboolean
Whether this is a strong reference.boolean
kill()
Kill this refvoid
setLastAccess
(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.PageRef
Get thePack
the referenced cache page is allocated for- Specified by:
getPack
in interfaceWindowCache.PageRef<ByteWindow>
- Returns:
- the
Pack
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 thePack
- Specified by:
getPosition
in interfaceWindowCache.PageRef<ByteWindow>
- Returns:
- the position of the referenced cache page in the
Pack
-
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
-
get
Description copied from interface:WindowCache.PageRef
Returns 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:
get
in interfaceWindowCache.PageRef<ByteWindow>
- Returns:
- The object to which this reference refers, or
null
if this reference object has been cleared
-
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
-