com.autonomy.nonaci.indexing.impl.DreResizeIndexCacheCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of indexing-api Show documentation
Show all versions of indexing-api Show documentation
API for indexing into IDOL using Java
/*
* (c) Copyright 2008-2015 Micro Focus or one of its affiliates.
*
* Licensed under the MIT License (the "License"); you may not use this file
* except in compliance with the License.
*
* The only warranties for products and services of Micro Focus and its affiliates
* and licensors ("Micro Focus") are as may be set forth in the express warranty
* statements accompanying such products and services. Nothing herein should be
* construed as constituting an additional warranty. Micro Focus shall not be
* liable for technical or editorial errors or omissions contained herein. The
* information contained herein is subject to change without notice.
*/
package com.autonomy.nonaci.indexing.impl;
import org.apache.commons.lang3.math.NumberUtils;
/**
* Allows you to resize the IDOL server indexing cache without restarting the server.
* The default size of the index cache at IDOL server startup is determined by the value of the
* IndexCacheMaxSize configuration parameter in the [IndexCache] section of the IDOL server
* configuration file. Using the DRERESIZEINDEXCACHE command allows you to change the cache size
* dynamically -- for example, to decrease it after performing a large bulk indexing job.
*
* Note: Because the cache must be flushed before it is resized, invoking this command more often than
* necessary can degrade indexing performance.
*
* @author boba
*/
public class DreResizeIndexCacheCommand extends IndexCommandImpl {
/** Creates a new instance of DreResizeIndexCacheCommand. */
public DreResizeIndexCacheCommand() {
super(CMD_DRERESIZEINDEXCACHE);
}
/**
* @return If the return value is -1 this indicates that the property hasn't been set.
*/
public int getIndexCacheMaxSize() {
return NumberUtils.toInt(get(PARAM_INDEX_CACHE_MAX_SIZE), -1);
}
/**
* Specify the desired size (in Kb) for the cache index. If the full requested amount is not available, the system
* will attempt to allocate as much of it as possible.
*
* @param indexCacheMaxSize The new cache size.
* @throws java.lang.IllegalArgumentException If the specified value is out of range (10240 < indexCacheMaxSize
* < 2048000).
*/
public void setIndexCacheMaxSize(final int indexCacheMaxSize) {
if((indexCacheMaxSize < 10240) || (indexCacheMaxSize > 2048000)) {
throw new IllegalArgumentException("The specified indexCacheMaxSize is out of range. The allowed range is 10240 < indexCacheMaxSize < 2048000.");
}
put(PARAM_INDEX_CACHE_MAX_SIZE, String.valueOf(indexCacheMaxSize));
}
} // End of class DreResizeIndexCacheCommand...