Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Autobuild is triggered when shutting down an Eclipse application
Autobuild is triggered when shutting down an Eclipse application [message #1773908] Fri, 06 October 2017 11:57 Go to next message
Minh Quang Tran is currently offline Minh Quang TranFriend
Messages: 19
Registered: September 2017
Junior Member
Hi everyone,

This question is related to Eclipse infrastructure and not particularly related to JDT. I don't know where else I can post.

in method AutoBuildJob#run
@Override
	public IStatus run(IProgressMonitor monitor) {
		//synchronized in case build starts during checkCancel
		synchronized (this) {
			if (monitor.isCanceled()) {
				return canceled();
			}
		}
		//if the system is shutting down, don't build
		if (systemBundle.getState() == Bundle.STOPPING)
			return Status.OK_STATUS;
		try {
			doBuild(monitor);
			lastBuild = System.currentTimeMillis();
			//if the build was successful then it should not be recorded as interrupted
			setInterrupted(false);
			return Status.OK_STATUS;
		} catch (OperationCanceledException e) {
			return canceled();
		} catch (CoreException sig) {
			return sig.getStatus();
		}
	}


It is checked if the Eclipse application is shutting down, the build is aborted. HOWEVER, I have been able to reproduce the behavior that though the system is shutting down, the OSGI's state is not set to STOPPING at the time the check is executed
if (systemBundle.getState() == Bundle.STOPPING) // Sometimes FALSE here even when application is shutting down!


Has anyone experienced something similar?

[Updated on: Fri, 06 October 2017 13:08]

Report message to a moderator

Re: Autobuild is triggered when shutting down an Eclipse application [message #1773913 is a reply to message #1773908] Fri, 06 October 2017 13:27 Go to previous messageGo to next message
Minh Quang Tran is currently offline Minh Quang TranFriend
Messages: 19
Registered: September 2017
Junior Member
According to https://bugs.eclipse.org/bugs/show_bug.cgi?id=75772, the "org.eclipse.osgi" will enter the STOPPING state after the Eclipse application has terminated. That means, the AutobuildJob may be executed during the process of closing the application before the Eclipse application has terminated.



Re: Autobuild is triggered when shutting down an Eclipse application [message #1773917 is a reply to message #1773913] Fri, 06 October 2017 13:40 Go to previous message
Minh Quang Tran is currently offline Minh Quang TranFriend
Messages: 19
Registered: September 2017
Junior Member
Thanks to the tips in https://bugs.eclipse.org/bugs/show_bug.cgi?id=75772, I can always reliably abort a build when the application is being closed using the following check:
			// Ignore if the application is closing
			if (Workbench.getInstance().isClosing()) {
				return;
			}

[Updated on: Fri, 06 October 2017 13:41]

Report message to a moderator

Previous Topic:blank window under Javafx
Next Topic:Problem to open Eclipse
Goto Forum:
  


Current Time: Mon Dec 18 01:35:19 GMT 2017

Powered by FUDForum. Page generated in 0.01857 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software