Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » ProvisioningJob and Invalid thread access
ProvisioningJob and Invalid thread access [message #1699073] Sat, 20 June 2015 09:38
ALex W is currently offline ALex WFriend
Messages: 56
Registered: July 2012
Member
Hello,

While adding some basic p2 feature to my app, I'm facing some strange issue.

I use an install operation such as :
//get the repository managers and define our repositories
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
   
List<IInstallableUnit> p2Units = new ArrayList<IInstallableUnit>(); // Construction of this list is skipped for clarity

final InstallOperation installOperation = new InstallOperation(new ProvisioningSession(getProvisioningAgent()), p2Units);		

IStatus operationStatus = installOperation.resolveModal(monitor);

if (operationStatus.getSeverity() > IStatus.WARNING) {
   LOG.error(new CoreException(operationStatus));
   return operationStatus;
}

final ProvisioningJob provisioningJob = installOperation.getProvisioningJob(new NullProgressMonitor());	   
provisioningJob.schedule();


It works (installation of unit and everything), but I'd like to add a progress monitor to the ProvisioningJob

So the 2 last lines become :
final ProvisioningJob provisioningJob = installOperation.getProvisioningJob(monitor);	   
provisioningJob.schedule();


And this throw an exception :
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4441)
	at org.eclipse.swt.SWT.error(SWT.java:4356)
	at org.eclipse.swt.SWT.error(SWT.java:4327)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:367)
	at org.eclipse.swt.widgets.ProgressBar.getSelection(ProgressBar.java:190)
	at org.eclipse.jface.dialogs.ProgressIndicator.worked(ProgressIndicator.java:139)
	at org.eclipse.jface.wizard.ProgressMonitorPart.internalWorked(ProgressMonitorPart.java:291)
	at org.eclipse.core.runtime.ProgressMonitorWrapper.internalWorked(ProgressMonitorWrapper.java:94)
	at org.eclipse.core.runtime.SubProgressMonitor.done(SubProgressMonitor.java:139)
	at org.eclipse.equinox.p2.operations.ProvisioningJob$DoubleProgressMonitor.done(ProvisioningJob.java:56)
	at org.eclipse.equinox.p2.operations.ProfileModificationJob.runModal(ProfileModificationJob.java:81)
	at org.eclipse.equinox.p2.operations.ProvisioningJob.run(ProvisioningJob.java:177)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


To complete, the monitor is created in a jface Wizard dialog and the install method above is called using a :
getContainer().run(false, false, new IRunnableWithProgress() {				
				@Override
				public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
						IStatus status = manager.install(monitor);
                                }
};


So afaik it's called from the UI thead. But it's like the update of the progress monitor is not.

Any idea ?

Edit :

I tried

  final ProvisioningJob provisioningJob = installOperation.getProvisioningJob(null);
  provisioningJob.runModal(monitor);


This code doesn't show any error, but it's like the job is not done (installation of unit not performed)

[Updated on: Sat, 20 June 2015 09:41]

Report message to a moderator

Previous Topic:Get list of installed IU
Next Topic:Using ServletBridge with Tomcat 7 (Servlet 3.0)
Goto Forum:
  


Current Time: Sun Sep 23 11:00:51 GMT 2018

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

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

Back to the top