[jbosstools-issues] [JBoss JIRA] (JBIDE-15058) Application Wizard: Embed Wizard: wizard jobs should not get cancelled autom. if a given time is exceeded.
Marián Labuda (JIRA)
issues at jboss.org
Mon Jul 14 07:48:30 EDT 2014
[ https://issues.jboss.org/browse/JBIDE-15058?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marián Labuda closed JBIDE-15058.
---------------------------------
Verified in JBDS 8.0.0.Beta3 build B178.
> Application Wizard: Embed Wizard: wizard jobs should not get cancelled autom. 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
> Labels: application_wizard
> Fix For: 4.2.0.Beta3
>
>
> 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 was sent by Atlassian JIRA
(v6.2.6#6264)
More information about the jbosstools-issues
mailing list