use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class MemoryPolicyInitializationTest method prepareCustomConfigWithOverridingDefault.
/**
*/
private void prepareCustomConfigWithOverridingDefault() {
memCfg = new MemoryConfiguration();
memCfg.setMemoryPolicies(new MemoryPolicyConfiguration().setName(DFLT_MEM_PLC_DEFAULT_NAME).setInitialSize(USER_CUSTOM_MEM_PLC_SIZE).setMaxSize(USER_DEFAULT_MEM_PLC_SIZE));
}
use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class MemoryPolicyInitializationTest method prepareCustomConfigWithOverridingDefaultAndCustom.
/**
*/
private void prepareCustomConfigWithOverridingDefaultAndCustom() {
memCfg = new MemoryConfiguration();
memCfg.setMemoryPolicies(new MemoryPolicyConfiguration().setName(DFLT_MEM_PLC_DEFAULT_NAME).setInitialSize(USER_CUSTOM_MEM_PLC_SIZE).setMaxSize(USER_DEFAULT_MEM_PLC_SIZE), new MemoryPolicyConfiguration().setName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME).setInitialSize(USER_CUSTOM_MEM_PLC_SIZE).setMaxSize(USER_CUSTOM_MEM_PLC_SIZE));
}
use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class PlatformConfigurationUtils method writeMemoryConfiguration.
/**
* Writes the memory configuration.
*
* @param w Writer.
* @param cfg Config.
*/
@SuppressWarnings("deprecation")
private static void writeMemoryConfiguration(BinaryRawWriter w, MemoryConfiguration cfg) {
if (cfg == null) {
w.writeBoolean(false);
return;
}
w.writeBoolean(true);
w.writeLong(cfg.getSystemCacheInitialSize());
w.writeLong(cfg.getSystemCacheMaxSize());
w.writeInt(cfg.getPageSize());
w.writeInt(cfg.getConcurrencyLevel());
w.writeString(cfg.getDefaultMemoryPolicyName());
MemoryPolicyConfiguration[] plcs = cfg.getMemoryPolicies();
if (plcs != null) {
w.writeInt(plcs.length);
for (MemoryPolicyConfiguration plc : plcs) {
w.writeString(plc.getName());
w.writeLong(plc.getInitialSize());
w.writeLong(plc.getMaxSize());
w.writeString(plc.getSwapFilePath());
w.writeInt(plc.getPageEvictionMode().ordinal());
w.writeDouble(plc.getEvictionThreshold());
w.writeInt(plc.getEmptyPagesPoolSize());
w.writeBoolean(plc.isMetricsEnabled());
w.writeInt(plc.getSubIntervals());
w.writeLong(plc.getRateTimeInterval());
}
} else
w.writeInt(0);
}
use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class PlatformConfigurationUtils method readMemoryConfiguration.
/**
* Reads the memory configuration.
*
* @param in Reader
* @return Config.
*/
@SuppressWarnings("deprecation")
private static MemoryConfiguration readMemoryConfiguration(BinaryRawReader in) {
MemoryConfiguration res = new MemoryConfiguration();
res.setSystemCacheInitialSize(in.readLong()).setSystemCacheMaxSize(in.readLong()).setPageSize(in.readInt()).setConcurrencyLevel(in.readInt()).setDefaultMemoryPolicyName(in.readString());
int cnt = in.readInt();
if (cnt > 0) {
MemoryPolicyConfiguration[] plcs = new MemoryPolicyConfiguration[cnt];
for (int i = 0; i < cnt; i++) {
MemoryPolicyConfiguration cfg = new MemoryPolicyConfiguration();
cfg.setName(in.readString()).setInitialSize(in.readLong()).setMaxSize(in.readLong()).setSwapFilePath(in.readString()).setPageEvictionMode(DataPageEvictionMode.values()[in.readInt()]).setEvictionThreshold(in.readDouble()).setEmptyPagesPoolSize(in.readInt()).setMetricsEnabled(in.readBoolean()).setSubIntervals(in.readInt()).setRateTimeInterval(in.readLong());
plcs[i] = cfg;
}
res.setMemoryPolicies(plcs);
}
return res;
}
use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class MemoryPolicyConfigValidationTest method createMemoryPolicy.
/**
* @param name Name of MemoryPolicyConfiguration.
* @param initialSize Initial size of MemoryPolicyConfiguration in bytes.
* @param maxSize Max size of MemoryPolicyConfiguration in bytes.
*/
private MemoryPolicyConfiguration createMemoryPolicy(String name, long initialSize, long maxSize) {
MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
plc.setName(name);
plc.setInitialSize(initialSize);
plc.setMaxSize(maxSize);
return plc;
}
Aggregations