public class WindowCacheConfig extends Object
Modifier and Type | Field and Description |
---|---|
static int |
KB
1024 (number of bytes in one kibibyte/kilobyte)
|
static int |
MB
1024
KB (number of bytes in one mebibyte/megabyte) |
Constructor and Description |
---|
WindowCacheConfig()
Create a default configuration.
|
Modifier and Type | Method and Description |
---|---|
WindowCacheConfig |
fromConfig(Config rc)
Update properties by setting fields from the configuration.
|
int |
getDeltaBaseCacheLimit()
Get maximum number of bytes to cache in delta base cache for inflated,
recently accessed objects, without delta chains.
|
boolean |
getExposeStatsViaJmx()
Tell whether the statistics JMX bean should be automatically registered.
|
long |
getPackedGitLimit()
Get maximum number bytes of heap memory to dedicate to caching pack file
data.
|
int |
getPackedGitOpenFiles()
Get maximum number of streams to open at a time.
|
int |
getPackedGitWindowSize()
Get size in bytes of a single window mapped or read in from the pack
file.
|
int |
getStreamFileThreshold()
Get the size threshold beyond which objects must be streamed.
|
void |
install()
Install this configuration as the live settings.
|
boolean |
isPackedGitMMAP()
Whether to use Java NIO virtual memory mapping for windows
|
boolean |
isPackedGitUseStrongRefs()
Get whether the window cache should use strong references or
SoftReferences
|
void |
setDeltaBaseCacheLimit(int newLimit)
Set maximum number of bytes to cache in delta base cache for inflated,
recently accessed objects, without delta chains.
|
void |
setExposeStatsViaJmx(boolean expose)
Defines whether the statistics JMX MBean should be automatically set up.
|
void |
setPackedGitLimit(long newLimit)
Set maximum number bytes of heap memory to dedicate to caching pack file
data.
|
void |
setPackedGitMMAP(boolean usemmap)
Set whether to enable use of Java NIO virtual memory mapping for windows
|
void |
setPackedGitOpenFiles(int fdLimit)
Set maximum number of streams to open at a time.
|
void |
setPackedGitUseStrongRefs(boolean useStrongRefs)
Set if the cache should use strong refs or soft refs
|
void |
setPackedGitWindowSize(int newSize)
Set size in bytes of a single window read in from the pack file.
|
void |
setStreamFileThreshold(int newLimit)
Set new byte limit for objects that must be streamed.
|
public static final int KB
public static final int MB
KB
(number of bytes in one mebibyte/megabyte)public int getPackedGitOpenFiles()
public void setPackedGitOpenFiles(int fdLimit)
fdLimit
- maximum number of streams to open at a time. Open packs count
against the process limitspublic long getPackedGitLimit()
public void setPackedGitLimit(long newLimit)
newLimit
- maximum number bytes of heap memory to dedicate to caching
pack file data.public boolean isPackedGitUseStrongRefs()
true
if the window cache should use strong references,
otherwise it will use SoftReference
spublic void setPackedGitUseStrongRefs(boolean useStrongRefs)
useStrongRefs
- if @{code true} the cache strongly references cache pages
otherwise it uses SoftReference
s which
can be evicted by the Java gc if heap is almost fullpublic int getPackedGitWindowSize()
public void setPackedGitWindowSize(int newSize)
newSize
- size in bytes of a single window read in from the pack file.public boolean isPackedGitMMAP()
true
enables use of Java NIO virtual memory mapping for
windows; false reads entire window into a byte[] with standard
read calls. Default false.public void setPackedGitMMAP(boolean usemmap)
usemmap
- true
enables use of Java NIO virtual memory mapping
for windows; false reads entire window into a byte[] with
standard read calls.public int getDeltaBaseCacheLimit()
public void setDeltaBaseCacheLimit(int newLimit)
newLimit
- maximum number of bytes to cache in delta base cache for
inflated, recently accessed objects, without delta chains.public int getStreamFileThreshold()
public void setStreamFileThreshold(int newLimit)
newLimit
- new byte limit for objects that must be streamed. Objects
smaller than this size can be obtained as a contiguous byte
array, while objects bigger than this size require using an
ObjectStream
.public boolean getExposeStatsViaJmx()
Registration of that bean via JMX is additionally subject to a boolean
JGit-specific user config "jmx.WindowCacheStats". The bean will be
registered only if this user config is true
and
getExposeStatsViaJmx() == true
.
By default, this returns true
unless changed via
setExposeStatsViaJmx(boolean)
.
install()
public void setExposeStatsViaJmx(boolean expose)
true
.) If set to false
, the JMX monitoring
bean is not registered.expose
- whether to register the JMX Beanpublic WindowCacheConfig fromConfig(Config rc)
If a property is not defined in the configuration, then it is left unmodified.
rc
- configuration to read properties from.this
.public void install()
The new configuration is applied immediately. If the new limits are smaller than what is currently cached, older entries will be purged as soon as possible to allow the cache to meet the new limit.
Copyright © 2021 Eclipse JGit Project. All rights reserved.