@Override protected CloudApplication doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { return client.getApplication(appName); } }.run(monitor);
boolean waitForStart(CloudFoundryOperations client, String deploymentId, IProgressMonitor monitor) throws InterruptedException { long initialInterval = CloudOperationsConstants.SHORT_INTERVAL; Thread.sleep(initialInterval); long timeLeft = CloudOperationsConstants.DEPLOYMENT_TIMEOUT - initialInterval; while (timeLeft > 0) { CloudApplication deploymentDetails = client.getApplication(deploymentId); if (isApplicationReady(deploymentDetails)) { return true; } Thread.sleep(CloudOperationsConstants.ONE_SECOND_INTERVAL); timeLeft -= CloudOperationsConstants.ONE_SECOND_INTERVAL; } return false; }
@Override protected Void doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { // Look up the existing urls locally first to avoid a client // call CloudFoundryApplicationModule existingAppModule = getCloudFoundryServer().getExistingCloudModule( appName); List<String> oldUrls = existingAppModule != null && existingAppModule.getDeploymentInfo() != null ? existingAppModule .getDeploymentInfo().getUris() : null; if (oldUrls == null) { oldUrls = client.getApplication(appName).getUris(); } client.updateApplicationUris(appName, urls); if (existingAppModule != null) { ServerEventHandler.getDefault().fireServerEvent( new AppUrlChangeEvent(getCloudFoundryServer(), CloudServerEvent.EVENT_APP_URL_CHANGED, existingAppModule.getLocalModule(), Status.OK_STATUS, oldUrls, urls)); } return null; } };