本文整理汇总了Java中org.spotter.shared.configuration.ConfigKeys类的典型用法代码示例。如果您正苦于以下问题:Java ConfigKeys类的具体用法?Java ConfigKeys怎么用?Java ConfigKeys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigKeys类属于org.spotter.shared.configuration包,在下文中一共展示了ConfigKeys类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
@Override
public void init(Properties problemDetectionConfiguration, EDCDetectionController controller) {
this.controller = controller;
perfReqThreshold = GlobalConfiguration.getInstance().getPropertyAsDouble(
ConfigKeys.PERFORMANCE_REQUIREMENT_THRESHOLD, ConfigKeys.DEFAULT_PERFORMANCE_REQUIREMENT_THRESHOLD);
perfReqConfidence = GlobalConfiguration.getInstance().getPropertyAsDouble(
ConfigKeys.PERFORMANCE_REQUIREMENT_CONFIDENCE, ConfigKeys.DEFAULT_PERFORMANCE_REQUIREMENT_CONFIDENCE);
String sRelativeQRT = controller.getProblemDetectionConfiguration().getProperty(
EDCExtension.PERF_REQ_RELATIVE_QUERY_RT_KEY,
String.valueOf(EDCExtension.PERF_REQ_RELATIVE_QUERY_RT_DEFAULT));
perfReqRelativeQueryRT = Double.valueOf(sRelativeQRT);
String sRelativeQRTDiff = controller.getProblemDetectionConfiguration().getProperty(
EDCExtension.PERF_REQ_RELATIVE_QUERY_RT_DIFF_KEY,
String.valueOf(EDCExtension.PERF_REQ_RELATIVE_QUERY_RT_DIFF_DEFAULT));
perfReqRelativeQueryRTDiff = Double.valueOf(sRelativeQRTDiff);
numUsers = GlobalConfiguration.getInstance().getPropertyAsLong(ConfigKeys.WORKLOAD_MAXUSERS);
}
示例2: setProblemDetectionConfiguration
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
@Override
public void setProblemDetectionConfiguration(Properties problemDetectionConfiguration) {
String warmupPhaseStr = problemDetectionConfiguration
.getProperty(RampExtension.KEY_STIMULATION_PHASE_DURATION_FACTOR);
stimulationPhaseDuration = (int) ((warmupPhaseStr != null ? Double.parseDouble(warmupPhaseStr)
: RampExtension.STIMULATION_PHASE_DURATION_DEFAULT) * GlobalConfiguration.getInstance()
.getPropertyAsDouble(ConfigKeys.EXPERIMENT_DURATION));
String experimentStepsStr = problemDetectionConfiguration.getProperty(RampExtension.KEY_EXPERIMENT_STEPS);
experimentSteps = experimentStepsStr != null ? Integer.parseInt(experimentStepsStr)
: RampExtension.EXPERIMENT_STEPS_DEFAULT;
String significanceStepsStr = problemDetectionConfiguration
.getProperty(RampExtension.KEY_REQUIRED_SIGNIFICANT_STEPS);
reuiqredSignificanceSteps = significanceStepsStr != null ? Integer.parseInt(significanceStepsStr)
: RampExtension.REQUIRED_SIGNIFICANT_STEPS_DEFAULT;
String significanceLevelStr = problemDetectionConfiguration
.getProperty(RampExtension.KEY_REQUIRED_SIGNIFICANCE_LEVEL);
requiredSignificanceLevel = significanceLevelStr != null ? Double.parseDouble(significanceLevelStr)
: RampExtension.REQUIRED_SIGNIFICANCE_LEVEL_DEFAULT;
}
示例3: stimulateSystem
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
private void stimulateSystem(int duration) throws WorkloadException {
LoadConfig lConfig = new LoadConfig();
lConfig.setNumUsers(GlobalConfiguration.getInstance().getPropertyAsInteger(ConfigKeys.WORKLOAD_MAXUSERS));
lConfig.setRampUpIntervalLength(GlobalConfiguration.getInstance().getPropertyAsInteger(
ConfigKeys.EXPERIMENT_RAMP_UP_INTERVAL_LENGTH));
lConfig.setRampUpUsersPerInterval(GlobalConfiguration.getInstance().getPropertyAsInteger(
ConfigKeys.EXPERIMENT_RAMP_UP_NUM_USERS_PER_INTERVAL));
lConfig.setCoolDownIntervalLength(GlobalConfiguration.getInstance().getPropertyAsInteger(
ConfigKeys.EXPERIMENT_COOL_DOWN_INTERVAL_LENGTH));
lConfig.setCoolDownUsersPerInterval(GlobalConfiguration.getInstance().getPropertyAsInteger(
ConfigKeys.EXPERIMENT_COOL_DOWN_NUM_USERS_PER_INTERVAL));
lConfig.setExperimentDuration(duration);
mainDetectionController.workloadAdapter().startLoad(lConfig);
mainDetectionController.workloadAdapter().waitForFinishedLoad();
}
示例4: startDiagnosis
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
/**
* Starts Dynamic Spotter diagnosis.
*
* @param jobDescription
* job description object containing the whole DS setup such as
* config values, environment and hierarchy configuration
* @throws IOException
* thrown if experiment fails
* @return job id, 0 if already running
*/
@POST
@Path(ConfigKeys.SPOTTER_REST_START_DIAG)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public SpotterServiceResponse<Long> startDiagnosis(JobDescription jobDescription) throws IOException {
try {
long jobId = SpotterServiceWrapper.getInstance().startDiagnosis(jobDescription);
if (jobId == 0) {
return new SpotterServiceResponse<Long>(jobId, ResponseStatus.INVALID_STATE);
} else {
return new SpotterServiceResponse<Long>(jobId, ResponseStatus.OK);
}
} catch (Exception e) {
return createErrorResponse(e);
}
}
示例5: requestResults
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
/**
* Retrieves results from a Dynamic Spotter diagnosis that matches the given
* job id.
*
* @param jobId
* the job id matching to the diagnosis run to fetch the results
* of
* @return the results container for the given id or <code>null</code> if
* for the id no results exist
*/
@POST
@Path(ConfigKeys.SPOTTER_REST_REQU_RESULTS)
@Consumes(MediaType.APPLICATION_JSON)
@Produces("application/zip")
public StreamingOutput requestResults(String jobId) {
if (jobId == null) {
return null;
}
try {
return SpotterServiceWrapper.getInstance().requestResults(jobId);
} catch (Exception e) {
LOGGER.error("Server error: " + e);
}
return null;
}
示例6: getDataPath
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
/**
* Returns the directory where raw experiment data is store in.
*
* @return directory where raw experiment data is store in.
*/
public String getDataPath() {
StringBuilder pathBuilder = new StringBuilder();
if (dataPath == null) {
pathBuilder.append(GlobalConfiguration.getInstance().getProperty(ConfigKeys.RESULT_DIR));
pathBuilder.append(getControllerIdentifier());
pathBuilder.append(System.getProperty("file.separator"));
pathBuilder.append(ResultsLocationConstants.CSV_SUB_DIR);
pathBuilder.append(System.getProperty("file.separator"));
dataPath = pathBuilder.toString();
} else {
pathBuilder.append(dataPath);
}
return pathBuilder.toString();
}
示例7: getAdditionalResourcesPath
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
/**
* Returns the path for additional resources.
*
* @return directory where additional resources shall be stored
*/
public String getAdditionalResourcesPath() {
StringBuilder pathBuilder = new StringBuilder();
if (resourcePath == null) {
pathBuilder.append(GlobalConfiguration.getInstance().getProperty(ConfigKeys.RESULT_DIR));
pathBuilder.append(getControllerIdentifier());
pathBuilder.append(System.getProperty("file.separator"));
pathBuilder.append(ResultsLocationConstants.RESULT_RESOURCES_SUB_DIR);
pathBuilder.append(System.getProperty("file.separator"));
resourcePath = pathBuilder.toString();
File file = new File(resourcePath);
if (!file.exists()) {
LpeFileUtils.createDir(resourcePath);
}
} else {
pathBuilder.append(resourcePath);
}
return pathBuilder.toString();
}
示例8: instrumentApplication
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
/**
* Instruments the target application according to the passed
* {@link instDescription}.
*
* @param instDescription
* instrumentation description describing the desired
* instrumentation state of the target application
* @throws InstrumentationException
* if instrumentation fails
* @throws MeasurementException
* if instrumentation fails
*/
protected void instrumentApplication(InstrumentationDescription instDescription) throws InstrumentationException,
MeasurementException {
ProgressManager.getInstance().updateProgressStatus(getProblemId(), DiagnosisStatus.INSTRUMENTING);
long instrumentationStart = System.currentTimeMillis();
InstrumentationDescriptionBuilder descriptionBuilder = new InstrumentationDescriptionBuilder();
String excludes = GlobalConfiguration.getInstance().getProperty(ConfigKeys.INSTRUMENTATION_EXCLUDES, "");
for (String exc : excludes.split(ConfigParameterDescription.LIST_VALUE_SEPARATOR)) {
descriptionBuilder.newGlobalRestriction().excludePackage(exc);
}
descriptionBuilder.appendOtherDescription(instDescription);
for (IExperimentReuser reuser : experimentReuser) {
descriptionBuilder.appendOtherDescription(reuser.getInstrumentationDescription());
}
InstrumentationDescription aggregatedDescription = descriptionBuilder.build();
getInstrumentationController().instrument(aggregatedDescription);
measurementController.prepareMonitoring(aggregatedDescription);
instrumented = true;
ProgressManager.getInstance().addAdditionalDuration(
(System.currentTimeMillis() - instrumentationStart) / SECOND);
}
示例9: retrieveRootPerformanceProblem
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
/**
* Reads the performance problem hierarchy file and returns the root
* performance problem of that hierarchy.
*
* @param resultsContainer
* container in which to store the original root problem
* @return the root problem
*/
private PerformanceProblem retrieveRootPerformanceProblem(ResultsContainer resultsContainer) {
String hierarchyFileName = GlobalConfiguration.getInstance()
.getProperty(ConfigKeys.CONF_PROBLEM_HIERARCHY_FILE);
if (hierarchyFileName == null || !new File(hierarchyFileName).exists()) {
throw new IllegalArgumentException(
"Please provide a proper configuration for the performance problem hierarchy file!");
}
PerformanceProblem problem = HierarchyFactory.getInstance().createPerformanceProblemHierarchy(
hierarchyFileName, resultsContainer);
if (problem.getChildren().isEmpty()) {
throw new IllegalArgumentException(
"The performance problem hierarchy file does not contain at least one problem!");
}
return problem;
}
示例10: createConfigFile
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
private static void createConfigFile(String baseDir, String hierarchyFile, String envFile) throws IOException {
String dir = System.getProperty("user.dir");
Properties properties = new Properties();
properties.setProperty("org.lpe.common.extension.appRootDir", cleanPath(dir));
properties.setProperty("org.spotter.conf.pluginDirNames", "plugins");
properties.setProperty(ConfigKeys.CONF_PROBLEM_HIERARCHY_FILE, cleanPath(hierarchyFile));
properties.setProperty(ConfigKeys.MEASUREMENT_ENVIRONMENT_FILE, cleanPath(envFile));
properties.setProperty(ConfigKeys.RESULT_DIR, cleanPath(baseDir));
properties.setProperty(ConfigKeys.EXPERIMENT_DURATION, "1");
properties.setProperty(ConfigKeys.EXPERIMENT_COOL_DOWN_INTERVAL_LENGTH, "1");
properties.setProperty(ConfigKeys.EXPERIMENT_COOL_DOWN_NUM_USERS_PER_INTERVAL, "1");
properties.setProperty(ConfigKeys.EXPERIMENT_RAMP_UP_INTERVAL_LENGTH, "1");
properties.setProperty(ConfigKeys.EXPERIMENT_RAMP_UP_NUM_USERS_PER_INTERVAL, "1");
properties.setProperty(ConfigKeys.WORKLOAD_MAXUSERS, "10");
FileWriter fWriter = new FileWriter(configFile);
properties.store(fWriter, null);
fWriter.close();
}
示例11: testDataPaths
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
@Test
public void testDataPaths() {
GlobalConfiguration.getInstance().putProperty(ConfigKeys.RESULT_DIR,
baseDir + System.getProperty("file.separator"));
DetectionResultManager drManager = new DetectionResultManager(CONTROLLER_NAME);
drManager.setProblemId(CONTROLLER_NAME);
drManager.setParentIdentifier(PARENT_DIR);
Assert.assertEquals(baseDir + DATA_DIR, drManager.getDataPath());
Assert.assertEquals(baseDir + DATA_DIR, drManager.getDataPath());
Assert.assertEquals(baseDir + RESOURCES_DIR, drManager.getAdditionalResourcesPath());
Assert.assertEquals(baseDir + RESOURCES_DIR, drManager.getAdditionalResourcesPath());
drManager.overwriteDataPath("anotherPath");
String newPath = "anotherPath" + System.getProperty("file.separator") + CONTROLLER_NAME + "-"
+ CONTROLLER_NAME.hashCode() + System.getProperty("file.separator") + "csv"
+ System.getProperty("file.separator");
Assert.assertEquals(newPath, drManager.getDataPath());
Assert.assertEquals(baseDir + RESOURCES_DIR, drManager.getAdditionalResourcesPath());
drManager.useParentDataDir();
Assert.assertEquals(
baseDir + System.getProperty("file.separator") + PARENT_DIR + System.getProperty("file.separator")
+ "csv" + System.getProperty("file.separator"), drManager.getDataPath());
Assert.assertEquals(baseDir + RESOURCES_DIR, drManager.getAdditionalResourcesPath());
}
示例12: testWithoutExperiments
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
@Test
public void testWithoutExperiments() throws InstrumentationException, MeasurementException, WorkloadException,
IOException {
String dataDir = tempDir.getAbsolutePath() + System.getProperty("file.separator") + "data"
+ System.getProperty("file.separator");
final DummyMeasurement dMeasurement = new DummyMeasurement(null);
GlobalConfiguration.getInstance().putProperty(ConfigKeys.OMIT_EXPERIMENTS, "true");
GlobalConfiguration.getInstance().putProperty(ConfigKeys.DUMMY_EXPERIMENT_DATA, dataDir);
Assert.assertEquals("MockDetection", detectionController.getProvider().getName());
Assert.assertEquals("test.value", detectionController.getProblemDetectionConfiguration().get("test.key"));
preGenerateData(dataDir, dMeasurement, "MockDetection-" + detectionController.getProblemId().hashCode());
SpotterResult result = detectionController.analyzeProblem();
Assert.assertTrue(result.isDetected());
Assert.assertEquals(0, DummyWorkload.numExperiments);
GlobalConfiguration.getInstance().putProperty(ConfigKeys.OMIT_EXPERIMENTS, "false");
}
示例13: startDiagnosis
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
/**
* Executes diagnostics process.
*
* @param jobDescription
* the job description to use
* @return job id for the started diagnosis task
*/
public long startDiagnosis(JobDescription jobDescription) {
SpotterServiceResponse<Long> response = webResource.path(ConfigKeys.SPOTTER_REST_BASE)
.path(ConfigKeys.SPOTTER_REST_START_DIAG).type(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON).post(new GenericType<SpotterServiceResponse<Long>>() {
}, jobDescription);
switch (response.getStatus()) {
case INVALID_STATE:
throw new IllegalStateException("Spotter is already running");
case OK:
return response.getPayload();
case SERVER_ERROR:
throw new RuntimeException("Server error: " + response.getErrorMessage());
default:
throw new IllegalStateException("Illegal response state!");
}
}
示例14: isRunning
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
/**
* Returns whether the Spotter Diagnostics is currently running. If the
* method returns <code>false</code> either the last run has finished
* successfully or the run had been canceled. For the second case the last
* exception thrown during that run can be requested via
* {@link #getLastRunException}.
*
* @return <code>true</code> if Spotter Diagnostics is currently running,
* <code>false</code> otherwise
*/
public synchronized boolean isRunning() {
SpotterServiceResponse<Boolean> response = webResource.path(ConfigKeys.SPOTTER_REST_BASE)
.path(ConfigKeys.SPOTTER_REST_IS_RUNNING).accept(MediaType.APPLICATION_JSON)
.get(new GenericType<SpotterServiceResponse<Boolean>>() {
});
switch (response.getStatus()) {
case OK:
return response.getPayload();
case SERVER_ERROR:
throw new RuntimeException("Server error: " + response.getErrorMessage());
case INVALID_STATE:
default:
throw new IllegalStateException("Illegal response state!");
}
}
示例15: getLastRunException
import org.spotter.shared.configuration.ConfigKeys; //导入依赖的package包/类
/**
*
* @return the exception thrown during the last diagnosis run or
* <code>null</code> if none
*/
public synchronized Exception getLastRunException() {
SpotterServiceResponse<Exception> response = webResource.path(ConfigKeys.SPOTTER_REST_BASE)
.path(ConfigKeys.SPOTTER_REST_LAST_EXCEPTION).accept(MediaType.APPLICATION_JSON)
.get(new GenericType<SpotterServiceResponse<Exception>>() {
});
switch (response.getStatus()) {
case OK:
return response.getPayload();
case SERVER_ERROR:
throw new RuntimeException("Server error: " + response.getErrorMessage());
case INVALID_STATE:
default:
throw new IllegalStateException("Illegal response state!");
}
}