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

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());	   

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);	   

And this throw an exception :
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(
	at org.eclipse.swt.SWT.error(
	at org.eclipse.swt.SWT.error(
	at org.eclipse.swt.widgets.Widget.error(
	at org.eclipse.swt.widgets.Widget.checkWidget(
	at org.eclipse.swt.widgets.ProgressBar.getSelection(
	at org.eclipse.jface.dialogs.ProgressIndicator.worked(
	at org.eclipse.jface.wizard.ProgressMonitorPart.internalWorked(
	at org.eclipse.core.runtime.ProgressMonitorWrapper.internalWorked(
	at org.eclipse.core.runtime.SubProgressMonitor.done(
	at org.eclipse.equinox.p2.operations.ProvisioningJob$DoubleProgressMonitor.done(
	at org.eclipse.equinox.p2.operations.ProfileModificationJob.runModal(

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() {				
				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);

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: Sat Oct 16 13:20:23 GMT 2021

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

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

Back to the top