本文整理汇总了Java中org.h2.mvstore.MVMap.putIfAbsent方法的典型用法代码示例。如果您正苦于以下问题:Java MVMap.putIfAbsent方法的具体用法?Java MVMap.putIfAbsent怎么用?Java MVMap.putIfAbsent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.h2.mvstore.MVMap
的用法示例。
在下文中一共展示了MVMap.putIfAbsent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: storeStepMetadata
import org.h2.mvstore.MVMap; //导入方法依赖的package包/类
private void storeStepMetadata(String workflowId, String stateId, OnlineStep step, Map<String, String> metrics) {
try {
MVStore wfMVStore = getStore(workflowId);
// save info about stored wf steps
MVMap<String, String> storedStepsMap = wfMVStore.openMap(STORED_METRICS_STEPS_MAP_NAME, mapBuilder);
storedStepsMap.putIfAbsent(step.name(), "1");
// save info about stored states per step
MVMap<String, String> stepStatesMap = wfMVStore.openMap(step.name() + STORED_METRICS_STATES_MAP_SUFFIX, mapBuilder);
stepStatesMap.putIfAbsent(stateId, "");
// save info about stored params per step
MVMap<String, String> stepParamsMap = wfMVStore.openMap(step.name() + STORED_METRICS_PARAMS_MAP_SUFFIX, mapBuilder);
for (String parameter : metrics.keySet()) {
stepParamsMap.putIfAbsent(parameter, "");
}
wfMVStore.commit();
} catch (Throwable e) {
String errorMessage = "Error storing metadata for wf " + workflowId + ", step " + step.name() + ", state " + stateId + ": " + e.getMessage();
LOGGER.error(errorMessage);
throw new RuntimeException(errorMessage, e);
}
}
示例2: storeViolationsMetadata
import org.h2.mvstore.MVMap; //导入方法依赖的package包/类
private void storeViolationsMetadata(String workflowId, String stateId, OnlineStep step, List<LimitViolation> violations) {
try {
MVStore wfMVStore = getStore(workflowId);
// save info about stored wf steps
MVMap<String, String> storedStepsMap = wfMVStore.openMap(STORED_VIOLATIONS_STEPS_MAP_NAME, mapBuilder);
storedStepsMap.putIfAbsent(step.name(), "1");
// save info about stored states per step
MVMap<String, String> stepStateMap = wfMVStore.openMap(step.name() + STORED_VIOLATIONS_STATES_MAP_SUFFIX, mapBuilder);
stepStateMap.putIfAbsent(stateId, "");
// save info about stored wf states
MVMap<String, String> storedStatesMap = wfMVStore.openMap(STORED_VIOLATIONS_STATES_MAP_NAME, mapBuilder);
storedStatesMap.putIfAbsent(stateId, "1");
// save info about stored steps per state
MVMap<String, String> stepStepMap = wfMVStore.openMap(stateId + STORED_VIOLATIONS_STEPS_MAP_SUFFIX, mapBuilder);
stepStepMap.putIfAbsent(step.name(), "");
wfMVStore.commit();
} catch (Throwable e) {
String errorMessage = "Error storing violations metadata for wf " + workflowId + ", step " + step.name() + ", state " + stateId + ": " + e.getMessage();
LOGGER.error(errorMessage);
throw new RuntimeException(errorMessage, e);
}
}
示例3: storePCViolationsMetadata
import org.h2.mvstore.MVMap; //导入方法依赖的package包/类
private synchronized void storePCViolationsMetadata(String workflowId, String stateId, String contingencyId, List<LimitViolation> violations) {
try {
MVStore wfMVStore = getStore(workflowId);
// save info about stored wf contingencies
MVMap<String, String> storedContingenciesMap = wfMVStore.openMap(STORED_PC_VIOLATIONS_CONTINGENCIES_MAP_NAME, mapBuilder);
storedContingenciesMap.putIfAbsent(contingencyId, "1");
// save info about stored states per contingency
MVMap<String, String> contingencyStateMap = wfMVStore.openMap(contingencyId + STORED_PC_VIOLATIONS_STATES_MAP_SUFFIX, mapBuilder);
contingencyStateMap.putIfAbsent(stateId, "");
// save info about stored wf states
MVMap<String, String> storedStatesMap = wfMVStore.openMap(STORED_PC_VIOLATIONS_STATES_MAP_NAME, mapBuilder);
storedStatesMap.putIfAbsent(stateId, "1");
// save info about stored contingencies per state
MVMap<String, String> stateContingencyMap = wfMVStore.openMap(stateId + STORED_PC_VIOLATIONS_CONTINGENCIES_MAP_SUFFIX, mapBuilder);
LOGGER.info("storePCViolationsMetadata: Adding contingency {} to map {} for workflow {}, state {}",
contingencyId,
stateId + STORED_PC_VIOLATIONS_CONTINGENCIES_MAP_SUFFIX,
workflowId,
stateId
);
//stateContingencyMap.putIfAbsent(contingencyId, "");
stateContingencyMap.put(contingencyId, "");
wfMVStore.commit();
} catch (Throwable e) {
String errorMessage = "Error storing pc violations metadata for wf " + workflowId + ", contingency " + contingencyId + ", state " + stateId + ": " + e.getMessage();
LOGGER.error(errorMessage);
throw new RuntimeException(errorMessage, e);
}
}
示例4: storePSLoadflowConvergence
import org.h2.mvstore.MVMap; //导入方法依赖的package包/类
private synchronized void storePSLoadflowConvergence(String workflowId, String stateId, String contingencyId, boolean loadflowConverge) {
try {
MVStore wfMVStore = getStore(workflowId);
// save info about stored wf contingencies
MVMap<String, String> storedContingenciesMap = wfMVStore.openMap(STORED_PC_LOADFLOW_CONTINGENCIES_MAP_NAME, mapBuilder);
storedContingenciesMap.putIfAbsent(contingencyId, "1");
// save info about stored states per contingency
MVMap<String, String> contingencyStateMap = wfMVStore.openMap(contingencyId + STORED_PC_LOADFLOW_STATES_MAP_SUFFIX, mapBuilder);
contingencyStateMap.putIfAbsent(stateId, Boolean.toString(loadflowConverge));
// save info about stored wf states
MVMap<String, String> storedStatesMap = wfMVStore.openMap(STORED_PC_LOADFLOW_STATES_MAP_NAME, mapBuilder);
storedStatesMap.putIfAbsent(stateId, "1");
// save info about stored contingencies per state
MVMap<String, String> stateContingencyMap = wfMVStore.openMap(stateId + STORED_PC_LOADFLOW_CONTINGENCIES_MAP_SUFFIX, mapBuilder);
LOGGER.info("storePSLoadflowConvergence: Adding contingency {} to map {} for workflow {}, state {}",
contingencyId,
stateId + STORED_PC_LOADFLOW_CONTINGENCIES_MAP_SUFFIX,
workflowId,
stateId
);
//stateContingencyMap.putIfAbsent(contingencyId, Boolean.toString(loadflowConverge));
stateContingencyMap.put(contingencyId, Boolean.toString(loadflowConverge));
wfMVStore.commit();
} catch (Throwable e) {
String errorMessage = "Error storing pc loadflow convergence for wf " + workflowId + ", contingency " + contingencyId + ", state " + stateId + ": " + e.getMessage();
LOGGER.error(errorMessage);
throw new RuntimeException(errorMessage, e);
}
}