/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this}. * @since 3.0 */ public WindowCacheConfig fromConfig(Config rc) { setPackedGitOpenFiles(rc.getInt( "core", null, "packedgitopenfiles", getPackedGitOpenFiles())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitLimit(rc.getLong( "core", null, "packedgitlimit", getPackedGitLimit())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitWindowSize(rc.getInt( "core", null, "packedgitwindowsize", getPackedGitWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitMMAP(rc.getBoolean( "core", null, "packedgitmmap", isPackedGitMMAP())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaBaseCacheLimit(rc.getInt( "core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$ long maxMem = Runtime.getRuntime().maxMemory(); long sft = rc.getLong( "core", null, "streamfilethreshold", getStreamFileThreshold()); //$NON-NLS-1$ //$NON-NLS-2$ sft = Math.min(sft, maxMem / 4); // don't use more than 1/4 of the heap sft = Math.min(sft, Integer.MAX_VALUE); // cannot exceed array length setStreamFileThreshold((int) sft); return this; }
/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this}. * @since 3.0 */ public WindowCacheConfig fromConfig(Config rc) { setPackedGitOpenFiles(rc.getInt( "core", null, "packedgitopenfiles", getPackedGitOpenFiles())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitLimit(rc.getLong( "core", null, "packedgitlimit", getPackedGitLimit())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitWindowSize(rc.getInt( "core", null, "packedgitwindowsize", getPackedGitWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitMMAP(rc.getBoolean( "core", null, "packedgitmmap", isPackedGitMMAP())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaBaseCacheLimit(rc.getInt( "core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$ long maxMem = Runtime.getRuntime().maxMemory(); long sft = rc.getLong( "core", null, "streamfilethreshold", getStreamFileThreshold()); //$NON-NLS-1$ //$NON-NLS-2$ sft = Math.min(sft, maxMem / 4); // don't use more than 1/4 of the heap sft = Math.min(sft, Integer.MAX_VALUE); // cannot exceed array length setStreamFileThreshold((int) sft); return this; }
/** * Update properties by setting fields from the configuration. * <p> * If a property is not defined in the configuration, then it is left * unmodified. * * @param rc * configuration to read properties from. * @return {@code this}. * @since 3.0 */ public WindowCacheConfig fromConfig(final Config rc) { setPackedGitOpenFiles(rc.getInt( "core", null, "packedgitopenfiles", getPackedGitOpenFiles())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitLimit(rc.getLong( "core", null, "packedgitlimit", getPackedGitLimit())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitWindowSize(rc.getInt( "core", null, "packedgitwindowsize", getPackedGitWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$ setPackedGitMMAP(rc.getBoolean( "core", null, "packedgitmmap", isPackedGitMMAP())); //$NON-NLS-1$ //$NON-NLS-2$ setDeltaBaseCacheLimit(rc.getInt( "core", null, "deltabasecachelimit", getDeltaBaseCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$ long maxMem = Runtime.getRuntime().maxMemory(); long sft = rc.getLong( "core", null, "streamfilethreshold", getStreamFileThreshold()); //$NON-NLS-1$ //$NON-NLS-2$ sft = Math.min(sft, maxMem / 4); // don't use more than 1/4 of the heap sft = Math.min(sft, Integer.MAX_VALUE); // cannot exceed array length setStreamFileThreshold((int) sft); return this; }