use of fish.payara.microprofile.faulttolerance.FaultToleranceServiceConfiguration in project Payara by payara.
the class SetFaultToleranceConfigurationCommand method execute.
@Override
public void execute(AdminCommandContext acc) {
Config targetConfig = targetUtil.getConfig(target);
FaultToleranceServiceConfiguration faultToleranceServiceConfiguration = targetConfig.getExtensionByType(FaultToleranceServiceConfiguration.class);
try {
ConfigSupport.apply((FaultToleranceServiceConfiguration configProxy) -> {
if (managedExecutorServiceName != null) {
configProxy.setManagedExecutorService(managedExecutorServiceName);
}
if (managedScheduledExecutorServiceName != null) {
configProxy.setManagedScheduledExecutorService(managedScheduledExecutorServiceName);
}
return null;
}, faultToleranceServiceConfiguration);
} catch (TransactionFailure ex) {
acc.getActionReport().failure(logger, "Failed to update Fault Tolerance configuration", ex);
}
}
use of fish.payara.microprofile.faulttolerance.FaultToleranceServiceConfiguration in project Payara by payara.
the class GetFaultToleranceConfigurationCommand method execute.
@Override
public void execute(AdminCommandContext acc) {
Config targetConfig = targetUtil.getConfig(target);
if (targetConfig == null) {
acc.getActionReport().setMessage("No such config name: " + targetUtil);
acc.getActionReport().setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
FaultToleranceServiceConfiguration faultToleranceServiceConfiguration = targetConfig.getExtensionByType(FaultToleranceServiceConfiguration.class);
ColumnFormatter columnFormatter = new ColumnFormatter(OUTPUT_HEADERS);
Object[] outputValues = { faultToleranceServiceConfiguration.getManagedExecutorService(), faultToleranceServiceConfiguration.getManagedScheduledExecutorService() };
columnFormatter.addRow(outputValues);
acc.getActionReport().appendMessage(columnFormatter.toString());
Map<String, Object> extraPropertiesMap = new HashMap<>();
extraPropertiesMap.put("managedExecutorServiceName", faultToleranceServiceConfiguration.getManagedExecutorService());
extraPropertiesMap.put("managedScheduledExecutorServiceName", faultToleranceServiceConfiguration.getManagedScheduledExecutorService());
Properties extraProperties = new Properties();
extraProperties.put("faultToleranceConfiguration", extraPropertiesMap);
acc.getActionReport().setExtraProperties(extraProperties);
}
Aggregations