use of com.microsoft.azuretools.azurecommons.rediscacheprocessors.ProcessingStrategy in project azure-tools-for-java by Microsoft.
the class CreateRedisCacheForm method onOK.
private void onOK() {
try {
Azure azure = azureManager.getAzure(currentSub.getSubscriptionId());
setSubscription(currentSub);
ProcessingStrategy processor = RedisCacheUtil.doGetProcessor(azure, skus, redisCacheNameValue, selectedLocationValue, selectedResGrpValue, selectedPriceTierValue, noSSLPort, newResGrp);
ExecutorService executor = Executors.newSingleThreadExecutor();
ListeningExecutorService executorService = MoreExecutors.listeningDecorator(executor);
ListenableFuture<Void> futureTask = executorService.submit(new CreateRedisCallable(processor));
final ProcessingStrategy processorInner = processor;
Futures.addCallback(futureTask, new FutureCallback<Void>() {
@Override
public void onSuccess(Void arg0) {
if (onCreate != null) {
onCreate.run();
}
}
@Override
public void onFailure(Throwable throwable) {
JOptionPane.showMessageDialog(null, throwable.getMessage(), "Error occurred when creating Redis Cache: " + redisCacheNameValue, JOptionPane.ERROR_MESSAGE, null);
try {
// notify the waitting thread the thread being waited incurred exception to clear blocking queue
processorInner.notifyCompletion();
} catch (InterruptedException ex) {
String msg = String.format(CREATING_ERROR_INDICATOR, "notifyCompletion", ex.getMessage());
PluginUtil.displayErrorDialogAndLog(message("errTtl"), msg, ex);
}
}
});
close(DialogWrapper.OK_EXIT_CODE, true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of com.microsoft.azuretools.azurecommons.rediscacheprocessors.ProcessingStrategy in project azure-tools-for-java by Microsoft.
the class CreateRedisCacheForm method onOK.
private void onOK() {
final Operation operation = TelemetryManager.createOperation(REDIS, CREATE_REDIS);
try {
operation.start();
Azure azure = azureManager.getAzure(currentSub.getId());
setSubscription(currentSub);
ProcessingStrategy processor = RedisCacheUtil.doGetProcessor(azure, skus, redisCacheNameValue, selectedLocationValue, selectedResGrpValue, selectedPriceTierValue, noSSLPort, newResGrp);
ExecutorService executor = Executors.newSingleThreadExecutor();
ListeningExecutorService executorService = MoreExecutors.listeningDecorator(executor);
ListenableFuture<Void> futureTask = executorService.submit(new CreateRedisCallable(processor));
final ProcessingStrategy processorInner = processor;
Futures.addCallback(futureTask, new FutureCallback<Void>() {
@Override
public void onSuccess(Void arg0) {
if (onCreate != null) {
onCreate.run();
operation.complete();
}
}
@Override
public void onFailure(Throwable throwable) {
DefaultLoader.getUIHelper().showError(throwable.getMessage(), "Error occurred when creating Redis Cache: " + redisCacheNameValue);
EventUtil.logError(operation, ErrorType.userError, new Exception(throwable), null, null);
operation.complete();
try {
// notify the waitting thread the thread being waited incurred exception to clear blocking queue
processorInner.notifyCompletion();
} catch (InterruptedException ex) {
String msg = String.format(CREATING_ERROR_INDICATOR, "notifyCompletion", ex.getMessage());
PluginUtil.displayErrorDialogAndLog(message("errTtl"), msg, ex);
}
}
}, MoreExecutors.directExecutor());
close(DialogWrapper.OK_EXIT_CODE, true);
} catch (Exception ex) {
ex.printStackTrace();
EventUtil.logError(operation, ErrorType.userError, ex, null, null);
operation.complete();
}
}
Aggregations