[jbosstools-issues] [JBoss JIRA] (JBIDE-15653) Import application wizard: Errors "Could not publish: Attempted to begin rule"

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Tue Oct 15 13:49:35 EDT 2013


    [ https://issues.jboss.org/browse/JBIDE-15653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12814308#comment-12814308 ] 

Andre Dietisheim commented on JBIDE-15653:
------------------------------------------

so the suggested fix is currently to end the current rule (which locks 0 projects) and start a new rule that locks the published project: 

{code}
if (allSubModulesPublished 
					|| (destFolder != null && destFolder.isAccessible())) {


				ISchedulingRule originalRule = Job.getJobManager().currentRule();
				Job.getJobManager().endRule(originalRule);
				ISchedulingRule tmpRule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(destProj);
				try {
					Job.getJobManager().beginRule(tmpRule);
					refreshProject(destProj, submon(monitor, 100));
					commitAndPushProject(destProj, behaviour, submon(monitor, 100));
				} finally {
					Job.getJobManager().endRule(tmpRule);
					Job.getJobManager().beginRule(originalRule);
				}
			} // else ignore. (one or more modules not published AND magic
				// folder doesn't exist
				// The previous exception will be propagated.
		}
{code}

This then made the git pushing fail with a similar locking issue. EGit tries to lock the whole workspace:

{code}
java.lang.IllegalArgumentException: Attempted to beginRule: R/, does not match outer scope rule: P/jbas7
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.internal.jobs.ThreadJob.illegalPush(ThreadJob.java:134)
	at org.eclipse.core.internal.jobs.ThreadJob.push(ThreadJob.java:333)
	at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:63)
	at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:286)
	at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:118)
	at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:2283)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2340)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327)
	at org.eclipse.egit.core.op.CommitOperation.execute(CommitOperation.java:200)
	at org.jboss.tools.openshift.egit.core.EGitUtils.commit(EGitUtils.java:392)
	at org.jboss.tools.openshift.egit.core.EGitUtils.commit(EGitUtils.java:363)
	at org.jboss.tools.openshift.egit.core.EGitUtils.commit(EGitUtils.java:368)
	at org.jboss.tools.openshift.express.internal.core.behaviour.OpenShiftServerPublishMethod.commitAndPushProject(OpenShiftServerPublishMethod.java:215)
	at org.jboss.tools.openshift.express.internal.core.behaviour.OpenShiftServerPublishMethod.publishFinish(OpenShiftServerPublishMethod.java:85)
	at org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior.publishFinish(DeployableServerBehavior.java:102)
	at org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior.publishFinish(DelegatingServerBehavior.java:168)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:1011)
	at org.jboss.tools.openshift.express.internal.core.behaviour.OpenShiftServerBehaviour.publish(OpenShiftServerBehaviour.java:38)
	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
	at org.jboss.tools.openshift.express.internal.core.behaviour.OpenShiftServerBehaviour.publish(OpenShiftServerBehaviour.java:45)
	at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3153)
	at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
{code}

To solve this we have to lock the whole workspace:

{code}
				IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
				ISchedulingRule workspaceLock = ruleFactory.modifyRule(ResourcesPlugin.getWorkspace().getRoot());
				try {
					Job.getJobManager().beginRule(workspaceLock, monitor);
					refreshProject(destProj, submon(monitor, 100));
					commitAndPushProject(destProj, behaviour, submon(monitor, 100));
				} finally {
					Job.getJobManager().endRule(workspaceLock);
					Job.getJobManager().beginRule(originalRule, monitor);
				}
{code}
                
> Import application wizard: Errors "Could not publish: Attempted to begin rule"
> ------------------------------------------------------------------------------
>
>                 Key: JBIDE-15653
>                 URL: https://issues.jboss.org/browse/JBIDE-15653
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: openshift
>    Affects Versions: 4.2.0.Alpha1
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>            Priority: Blocker
>             Fix For: 4.2.0.Alpha1
>
>         Attachments: could-not-import.png, gitignore-committed-locally.png
>
>


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