@ -47,6 +47,7 @@ import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_CORE_SECTION;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_DFS_SECTION ;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_BLOCK_LIMIT ;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_BLOCK_SIZE ;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_CONCURRENCY_LEVEL ;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_STREAM_RATIO ;
import java.text.MessageFormat ;
@ -65,12 +66,14 @@ public class DfsBlockCacheConfig {
private long blockLimit ;
private int blockSize ;
private double streamRatio ;
private int concurrencyLevel ;
/** Create a default configuration. */
public DfsBlockCacheConfig ( ) {
setBlockLimit ( 32 * MB ) ;
setBlockSize ( 64 * KB ) ;
setStreamRatio ( 0 . 30 ) ;
setConcurrencyLevel ( 32 ) ;
}
/ * *
@ -110,6 +113,28 @@ public class DfsBlockCacheConfig {
return this ;
}
/ * *
* @return the estimated number of threads concurrently accessing the cache .
* < b > Default is 32 . < / b >
* @since 4 . 6
* /
public int getConcurrencyLevel ( ) {
return concurrencyLevel ;
}
/ * *
* @param newConcurrencyLevel
* the estimated number of threads concurrently accessing the
* cache .
* @return { @code this }
* @since 4 . 6
* /
public DfsBlockCacheConfig setConcurrencyLevel (
final int newConcurrencyLevel ) {
concurrencyLevel = newConcurrencyLevel ;
return this ;
}
/ * *
* @return highest percentage of { @link # getBlockLimit ( ) } a single pack can
* occupy while being copied by the pack reuse strategy . < b > Default
@ -154,6 +179,12 @@ public class DfsBlockCacheConfig {
CONFIG_KEY_BLOCK_SIZE ,
getBlockSize ( ) ) ) ;
setConcurrencyLevel ( rc . getInt (
CONFIG_CORE_SECTION ,
CONFIG_DFS_SECTION ,
CONFIG_KEY_CONCURRENCY_LEVEL ,
getConcurrencyLevel ( ) ) ) ;
String v = rc . getString (
CONFIG_CORE_SECTION ,
CONFIG_DFS_SECTION ,