P/Users, does not match outer scope rule [message #992231] |
Fri, 21 December 2012 01:54  |
Eclipse User |
|
|
|
In a button, on execAction, I try to write a file. I get this error:
!ENTRY <none> 4 0 2012-12-21 07:49:34.976
!MESSAGE Attempted to beginRule: P/Users, does not match outer scope rule: org.eclipse.scout.rt.client.ClientRule@37a5e471
!STACK 0
java.lang.IllegalArgumentException: Attempted to beginRule: P/Users, does not match outer scope rule: org.eclipse.scout.rt.client.ClientRule@37a5e471
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:85)
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:2282)
at org.eclipse.core.internal.resources.Folder.create(Folder.java:92)
at org.eclipse.core.internal.resources.Folder.create(Folder.java:125)
at ...
What should I do?
|
|
|
|
Re: P/Users, does not match outer scope rule [message #993841 is a reply to message #992231] |
Tue, 25 December 2012 12:35   |
Eclipse User |
|
|
|
Hi Jérémie
It looks like you get this error because of conflicting scheduling rules while accessing a resource (a file or folder).
Code executed in one of the Scout model classes (such as execClickAction() on a button) is typically running inside a ClientSyncJob. All ClientSyncJobs are guaranteed to run sequentially; the current implementation is using a scheduling rule (ClientRule) which is set on the job. An ISchedulingRule basically represents a semaphore, allowing for exclusive access to a given resource, or in our case, for a sequential scheduling order. However, by design of the Jobs API, any given job can only aquire a single scheduling rule at the time (unless you are using hierarchical scheduling rules...).
An IResource (a file or a folder) also represents (inherits from) ISchedulingRule. Any (modifying) access to such a resource is guarded by the respective scheduling rule. We now get a runtime exception when trying to aquire the scheduling rule for such a resource, because we are already holding an (unrelated) scheduling rule in our ClientSyncJob.
For more information on the Jobs API and scheduling rules, see the following references:
http://www.eclipse.org/articles/Article-Concurrency/jobs-api.html
http://help.eclipse.org/juno/topic/org.eclipse.platform.doc.isv/guide/runtime_jobs_rules.htm?cp=2_0_3_5_2
As a workaround, it should be possible to start another ClientAsyncJob (which does not hold any scheduling rules) from within execClickAction to perform your resource related operations. You can wait for the async job to finish using the join() method.
|
|
|
|
Re: P/Users, does not match outer scope rule [message #996554 is a reply to message #995829] |
Wed, 02 January 2013 06:09  |
Eclipse User |
|
|
|
I have isolated my code in a job (I serialize the EMF Object eForm to XMI):
Job job = new Job("Save to XMI: " + eForm.getClassName()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
XMIUtility.toXMI(eForm);
return Status.OK_STATUS;
}
};
job.schedule();
It works!
Many thanks to Lukas Huser !!!
|
|
|
Powered by
FUDForum. Page generated in 0.25392 seconds