Top Description Fields Constructors Methods
org.eclipse.jgit.storage.file

public Class WindowCacheConfig

extends Object
Class Inheritance
Static Imports
org.eclipse.jgit.lib.ConfigConstants.CONFIG_CORE_SECTION, .ConfigConstants.CONFIG_KEY_DELTA_BASE_CACHE_LIMIT, .ConfigConstants.CONFIG_KEY_PACKED_GIT_LIMIT, .ConfigConstants.CONFIG_KEY_PACKED_GIT_MMAP, .ConfigConstants.CONFIG_KEY_PACKED_GIT_OPENFILES, .ConfigConstants.CONFIG_KEY_PACKED_GIT_WINDOWSIZE, .ConfigConstants.CONFIG_KEY_STREAM_FILE_THRESHOLD, .ConfigConstants.CONFIG_KEY_PACKED_GIT_USE_STRONGREFS, .ConfigConstants.CONFIG_KEY_PACKED_INDEX_GIT_USE_STRONGREFS

Configuration parameters for JVM-wide buffer cache used by JGit.

Field Summary

Modifier and TypeField and Description
private int
private boolean
public static final int
KB

1024 (number of bytes in one kibibyte/kilobyte)

public static final int
MB

1024 KB (number of bytes in one mebibyte/megabyte)

private long
private boolean
private int
private int
private int
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
public
WindowCacheConfig()

Create a default configuration.

Method Summary

Modifier and TypeMethod and Description
public WindowCacheConfig

Returns:

this.
fromConfig
(Config
configuration to read properties from.
rc
)

Update properties by setting fields from the configuration.

public int

Returns:

maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains. Default 10 MB.
getDeltaBaseCacheLimit
()

Get maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains.

public boolean

Returns:

whether to expose WindowCacheStats statistics via JMX upon install()
getExposeStatsViaJmx
()

Tell whether the statistics JMX bean should be automatically registered.

public long

Returns:

maximum number bytes of heap memory to dedicate to caching pack file data. Default is 10 MB.
getPackedGitLimit
()

Get maximum number bytes of heap memory to dedicate to caching pack file data.

public int

Returns:

maximum number of streams to open at a time. Open packs count against the process limits. Default is 128.
getPackedGitOpenFiles
()

Get maximum number of streams to open at a time.

public int

Returns:

size in bytes of a single window mapped or read in from the pack file. Default is 8 KB.
getPackedGitWindowSize
()

Get size in bytes of a single window mapped or read in from the pack file.

public int

Returns:

the size threshold beyond which objects must be streamed.
getStreamFileThreshold
()

Get the size threshold beyond which objects must be streamed.

public void
install()

Install this configuration as the live settings.

public boolean

Returns:

true enables use of Java NIO virtual memory mapping for windows; false reads entire window into a byte[] with standard read calls. Default false.
isPackedGitMMAP
()

Whether to use Java NIO virtual memory mapping for windows

public boolean

Returns:

true if the window cache should use strong references, otherwise it will use java.lang.ref.SoftReferences
isPackedGitUseStrongRefs
()

Get whether the window cache should use strong references or SoftReferences

public boolean

Returns:

true if the cached Pack indices should use strong references, otherwise it will use java.lang.ref.SoftReferences
isPackedIndexGitUseStrongRefs
()

Get whether the Pack indices cache should use strong references or SoftReferences

public void
setDeltaBaseCacheLimit(int
maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains.
newLimit
)

Set maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains.

public void
setExposeStatsViaJmx(boolean
whether to register the JMX Bean
expose
)

Defines whether the statistics JMX MBean should be automatically set up.

public void
setPackedGitLimit(long
maximum number bytes of heap memory to dedicate to caching pack file data.
newLimit
)

Set maximum number bytes of heap memory to dedicate to caching pack file data.

public void
setPackedGitMMAP(boolean
true enables use of Java NIO virtual memory mapping for windows; false reads entire window into a byte[] with standard read calls.
usemmap
)

Set whether to enable use of Java NIO virtual memory mapping for windows

public void
setPackedGitOpenFiles(int
maximum number of streams to open at a time. Open packs count against the process limits
fdLimit
)

Set maximum number of streams to open at a time.

public void
setPackedGitUseStrongRefs(boolean
if @{code true} the cache strongly references cache pages otherwise it uses java.lang.ref.SoftReferences which can be evicted by the Java gc if heap is almost full
useStrongRefs
)

Set if the cache should use strong refs or soft refs

public void
setPackedGitWindowSize(int
size in bytes of a single window read in from the pack file.
newSize
)

Set size in bytes of a single window read in from the pack file.

public void
setPackedIndexGitUseStrongRefs(boolean
if @{code true} the Pack strongly references cached indices otherwise it uses java.lang.ref.SoftReferences which can be evicted by the Java gc if heap is almost full
useStrongRefs
)

Set if the Pack indices cache should use strong refs or soft refs

public void
setStreamFileThreshold(int
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 org.eclipse.jgit.lib.ObjectStream.
newLimit
)

Set new byte limit for objects that must be streamed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

deltaBaseCacheLimitback to summary
private int deltaBaseCacheLimit
exposeStatsback to summary
private boolean exposeStats
KBback to summary
public static final int KB

1024 (number of bytes in one kibibyte/kilobyte)

MBback to summary
public static final int MB

1024 KB (number of bytes in one mebibyte/megabyte)

packedGitLimitback to summary
private long packedGitLimit
packedGitMMAPback to summary
private boolean packedGitMMAP
packedGitOpenFilesback to summary
private int packedGitOpenFiles
packedGitWindowSizeback to summary
private int packedGitWindowSize
streamFileThresholdback to summary
private int streamFileThreshold
useStrongIndexRefsback to summary
private boolean useStrongIndexRefs
useStrongRefsback to summary
private boolean useStrongRefs

Constructor Detail

WindowCacheConfigback to summary
public WindowCacheConfig()

Create a default configuration.

Method Detail

fromConfigback to summary
public WindowCacheConfig fromConfig(Config rc)

Update properties by setting fields from the configuration.

If a property is not defined in the configuration, then it is left unmodified.

Parameters
rc:Config

configuration to read properties from.

Returns:WindowCacheConfig

this.

Since
3.0
getDeltaBaseCacheLimitback to summary
public int getDeltaBaseCacheLimit()

Get maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains.

Returns:int

maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains. Default 10 MB.

getExposeStatsViaJmxback to summary
public boolean getExposeStatsViaJmx()

Tell whether the statistics JMX bean should be automatically registered.

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).

Returns:boolean

whether to expose WindowCacheStats statistics via JMX upon install()

Since
5.8
getPackedGitLimitback to summary
public long getPackedGitLimit()

Get maximum number bytes of heap memory to dedicate to caching pack file data.

Returns:long

maximum number bytes of heap memory to dedicate to caching pack file data. Default is 10 MB.

getPackedGitOpenFilesback to summary
public int getPackedGitOpenFiles()

Get maximum number of streams to open at a time.

Returns:int

maximum number of streams to open at a time. Open packs count against the process limits. Default is 128.

getPackedGitWindowSizeback to summary
public int getPackedGitWindowSize()

Get size in bytes of a single window mapped or read in from the pack file.

Returns:int

size in bytes of a single window mapped or read in from the pack file. Default is 8 KB.

getStreamFileThresholdback to summary
public int getStreamFileThreshold()

Get the size threshold beyond which objects must be streamed.

Returns:int

the size threshold beyond which objects must be streamed.

installback to summary
public void install()

Install this configuration as the live settings.

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.

Annotations
@SuppressWarnings:deprecation
Since
3.0
isPackedGitMMAPback to summary
public boolean isPackedGitMMAP()

Whether to use Java NIO virtual memory mapping for windows

Returns:boolean

true enables use of Java NIO virtual memory mapping for windows; false reads entire window into a byte[] with standard read calls. Default false.

isPackedGitUseStrongRefsback to summary
public boolean isPackedGitUseStrongRefs()

Get whether the window cache should use strong references or SoftReferences

Returns:boolean

true if the window cache should use strong references, otherwise it will use java.lang.ref.SoftReferences

Since
5.1.13
isPackedIndexGitUseStrongRefsback to summary
public boolean isPackedIndexGitUseStrongRefs()

Get whether the Pack indices cache should use strong references or SoftReferences

Returns:boolean

true if the cached Pack indices should use strong references, otherwise it will use java.lang.ref.SoftReferences

Since
6.7
setDeltaBaseCacheLimitback to summary
public void setDeltaBaseCacheLimit(int newLimit)

Set maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains.

Parameters
newLimit:int

maximum number of bytes to cache in delta base cache for inflated, recently accessed objects, without delta chains.

setExposeStatsViaJmxback to summary
public void setExposeStatsViaJmx(boolean expose)

Defines whether the statistics JMX MBean should be automatically set up. (By default true.) If set to false, the JMX monitoring bean is not registered.

Parameters
expose:boolean

whether to register the JMX Bean

Since
5.8
setPackedGitLimitback to summary
public void setPackedGitLimit(long newLimit)

Set maximum number bytes of heap memory to dedicate to caching pack file data.

Parameters
newLimit:long

maximum number bytes of heap memory to dedicate to caching pack file data.

setPackedGitMMAPback to summary
public void setPackedGitMMAP(boolean usemmap)

Set whether to enable use of Java NIO virtual memory mapping for windows

Parameters
usemmap:boolean

true enables use of Java NIO virtual memory mapping for windows; false reads entire window into a byte[] with standard read calls.

setPackedGitOpenFilesback to summary
public void setPackedGitOpenFiles(int fdLimit)

Set maximum number of streams to open at a time.

Parameters
fdLimit:int

maximum number of streams to open at a time. Open packs count against the process limits

setPackedGitUseStrongRefsback to summary
public void setPackedGitUseStrongRefs(boolean useStrongRefs)

Set if the cache should use strong refs or soft refs

Parameters
useStrongRefs:boolean

if @{code true} the cache strongly references cache pages otherwise it uses java.lang.ref.SoftReferences which can be evicted by the Java gc if heap is almost full

Since
5.1.13
setPackedGitWindowSizeback to summary
public void setPackedGitWindowSize(int newSize)

Set size in bytes of a single window read in from the pack file.

Parameters
newSize:int

size in bytes of a single window read in from the pack file.

setPackedIndexGitUseStrongRefsback to summary
public void setPackedIndexGitUseStrongRefs(boolean useStrongRefs)

Set if the Pack indices cache should use strong refs or soft refs

Parameters
useStrongRefs:boolean

if @{code true} the Pack strongly references cached indices otherwise it uses java.lang.ref.SoftReferences which can be evicted by the Java gc if heap is almost full

Since
6.7
setStreamFileThresholdback to summary
public void setStreamFileThreshold(int newLimit)

Set new byte limit for objects that must be streamed.

Parameters
newLimit:int

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 org.eclipse.jgit.lib.ObjectStream.