private void deleteInstance(@NotNull final VmwareCloudInstance instance) { if (instance.getErrorInfo() == null) { LOG.info("Will delete instance " + instance.getName()); final VmwareInstance vmInstance; try { vmInstance = myApiConnector.getInstanceDetails(instance.getName()); myAsyncTaskExecutor.executeAsync( vmInstance.deleteInstance(), new ImageStatusTaskWrapper(instance) { @Override public void onSuccess() { removeInstance(instance.getName()); } }); } catch (VmwareCheckedCloudException e) { LOG.warn("An exception during deleting instance " + instance.getName(), e); instance.updateErrors(TypedCloudErrorInfo.fromException(e)); } } else { LOG.warn( String.format( "Won't delete instance %s with error: %s (%s)", instance.getName(), instance.getErrorInfo().getMessage(), instance.getErrorInfo().getDetailedMessage())); } }