[jbosstools-issues] [JBoss JIRA] (JBIDE-15058) Application Wizard: Embed Wizard: Turn wizard jobs not toget cancelled if a given time is exceeded.

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Fri Jun 28 11:05:21 EDT 2013


Andre Dietisheim created JBIDE-15058:
----------------------------------------

             Summary: Application Wizard: Embed Wizard: Turn wizard jobs not toget cancelled if a given time is exceeded.
                 Key: JBIDE-15058
                 URL: https://issues.jboss.org/browse/JBIDE-15058
             Project: Tools (JBoss Tools)
          Issue Type: Enhancement
          Components: openshift
    Affects Versions: 4.1.0.CR1
            Reporter: Andre Dietisheim
            Assignee: Andre Dietisheim
             Fix For: 4.2.x


The current implementation of WizardUtils#runInWizard will always cancel the job it is running if it exceeds a given timeout. If the caller is not providing a timeout a default timeout of 2 minutes is applied:

{code:title=org.jboss.tools.common.ui.WizardUtils#runInWizard}
public static IStatus runInWizard(final Job job, final DelegatingProgressMonitor delegatingMonitor,
			final IWizardContainer container) throws InvocationTargetException, InterruptedException {
		return runInWizard(job, delegatingMonitor, container, DEFAULT_TIMEOUT);
	}
{code}

All Jobs in OpenShiftApplicationWizard are thus using timeouts. Once the timeouts are reached the WizardUtils#runInWizard will cancel them. We should offer #runInWizard that never timeouts and cancels and use these in the OpenShiftApplicationWizard and all other jobs that use this facility:

{code:EmbedCartridgeWizardPage}
EmbedCartridgesJob job = new EmbedCartridgesJob(
		new ArrayList<IEmbeddableCartridge>(pageModel.getSelectedEmbeddableCartridges()), 
		pageModel.getApplication());
IStatus result = WizardUtils.runInWizard(job, job.getDelegatingProgressMonitor(), getContainer(), EMBED_CARTRIDGES_TIMEOUT);
{code}

{code:OpenShiftApplicationWizard}
	private IStatus createApplication() {
		try {
			CreateApplicationJob job = new CreateApplicationJob(
					model.getApplicationName()
					, model.getApplicationCartridge()
					, model.getApplicationScale()
					, model.getApplicationGearProfile()
					, model.getInitialGitUrl()
					, model.getConnection().getDefaultDomain());
			IStatus status = WizardUtils.runInWizard(
					job, job.getDelegatingProgressMonitor(), getContainer(), APP_CREATE_TIMEOUT);
			IApplication application = job.getApplication();
			model.setApplication(application);
			if (status.isOK()) {
				openLogDialog(application, job.isTimeouted(status));
			}
			return status;
		} catch (Exception e) {
			return OpenShiftUIActivator.createErrorStatus(
					NLS.bind("Could not create application {0}", model.getApplicationName()), e);
		}
	}

	private IStatus addCartridges(final IApplication application, final Set<IEmbeddableCartridge> selectedCartridges) {
		try {
			EmbedCartridgesJob job = new EmbedCartridgesJob(
					new ArrayList<IEmbeddableCartridge>(model.getSelectedEmbeddableCartridges()),
					true, // dont remove cartridges
					model.getApplication());
			IStatus result = WizardUtils.runInWizard(
					job, job.getDelegatingProgressMonitor(), getContainer(), EMBED_CARTRIDGES_TIMEOUT);
			if (result.isOK()) {
				openLogDialog(job.getAddedCartridges(), job.isTimeouted(result));
			}
			return result;
		} catch (Exception e) {
			return OpenShiftUIActivator.createErrorStatus(
					NLS.bind("Could not add/remove cartridges for application {0}", application.getName()), e);
		}
	}

	private IStatus waitForApplication(IApplication application) {
		try {
			AbstractDelegatingMonitorJob job = new WaitForApplicationJob(application, getShell());
			IStatus status = WizardUtils.runInWizard(
					job, job.getDelegatingProgressMonitor(), getContainer(), APP_WAIT_TIMEOUT);
			return status;
		} catch (Exception e) {
			return OpenShiftUIActivator.createErrorStatus(
					NLS.bind("Could not wait for application {0} to become reachable", application.getName()), e);
		}
	}

	private boolean importProject() {
		try {
			final DelegatingProgressMonitor delegatingMonitor = new DelegatingProgressMonitor();
			IStatus jobResult = WizardUtils.runInWizard(
					new ImportJob(delegatingMonitor), delegatingMonitor, getContainer(), IMPORT_TIMEOUT);
			return JobUtils.isOk(jobResult);
		} catch (Exception e) {
			ErrorDialog.openError(getShell(), "Error", "Could not create local git repository.", OpenShiftUIActivator
					.createErrorStatus("An exception occurred while creating local git repository.", e));
			return false;
		}
	}
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list