use of com.linkedin.kafka.cruisecontrol.executor.ConcurrencyType in project cruise-control by linkedin.
the class ParameterUtils method concurrencyTypes.
private static Set<ConcurrencyType> concurrencyTypes(HttpServletRequest request, boolean isEnable) throws UnsupportedEncodingException {
Set<String> concurrencyForStringSet = parseParamToStringSet(request, isEnable ? ENABLE_CONCURRENCY_ADJUSTER_FOR_PARAM : DISABLE_CONCURRENCY_ADJUSTER_FOR_PARAM);
Set<ConcurrencyType> concurrencyTypes = new HashSet<>();
try {
for (String concurrencyForString : concurrencyForStringSet) {
concurrencyTypes.add(ConcurrencyType.valueOf(concurrencyForString.toUpperCase()));
}
} catch (IllegalArgumentException iae) {
throw new UserRequestException(String.format("Unsupported concurrency types in %s. Supported: %s", concurrencyForStringSet, ConcurrencyType.cachedValues()));
}
return Collections.unmodifiableSet(concurrencyTypes);
}
use of com.linkedin.kafka.cruisecontrol.executor.ConcurrencyType in project cruise-control by linkedin.
the class AdminRequest method processUpdateConcurrencyAdjusterRequest.
protected void processUpdateConcurrencyAdjusterRequest(Map<ConcurrencyType, Boolean> concurrencyAdjusterBefore, Map<ConcurrencyType, Boolean> concurrencyAdjusterAfter, StringBuilder minIsrBasedConcurrencyAdjustmentRequest) {
UpdateConcurrencyAdjusterParameters updateConcurrencyAdjusterParameters = _parameters.updateConcurrencyAdjusterParameters();
if (updateConcurrencyAdjusterParameters != null) {
Set<ConcurrencyType> disableConcurrencyAdjusterFor = updateConcurrencyAdjusterParameters.disableConcurrencyAdjusterFor();
Set<ConcurrencyType> enableConcurrencyAdjusterFor = updateConcurrencyAdjusterParameters.enableConcurrencyAdjusterFor();
Boolean minIsrBasedConcurrencyAdjustment = updateConcurrencyAdjusterParameters.minIsrBasedConcurrencyAdjustment();
if (minIsrBasedConcurrencyAdjustment != null) {
boolean oldValue = _kafkaCruiseControl.setConcurrencyAdjusterMinIsrCheck(minIsrBasedConcurrencyAdjustment);
minIsrBasedConcurrencyAdjustmentRequest.append(String.format("MinISR-based concurrency adjustment is modified (before: %s after: %s).", oldValue, minIsrBasedConcurrencyAdjustment));
LOG.info("MinISR-based concurrency adjustment is modified by user (before: {} after: {}).", oldValue, minIsrBasedConcurrencyAdjustment);
}
for (ConcurrencyType type : disableConcurrencyAdjusterFor) {
concurrencyAdjusterBefore.put(type, _kafkaCruiseControl.setConcurrencyAdjusterFor(type, false));
concurrencyAdjusterAfter.put(type, false);
}
for (ConcurrencyType adjusterType : enableConcurrencyAdjusterFor) {
concurrencyAdjusterBefore.put(adjusterType, _kafkaCruiseControl.setConcurrencyAdjusterFor(adjusterType, true));
concurrencyAdjusterAfter.put(adjusterType, true);
}
if (!disableConcurrencyAdjusterFor.isEmpty() || !enableConcurrencyAdjusterFor.isEmpty()) {
LOG.info("Concurrency adjuster state is modified by user (before: {} after: {}).", concurrencyAdjusterBefore, concurrencyAdjusterAfter);
}
}
}
Aggregations