[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-cvs-dev] How to handle rules ?

Mike,

The article at http://www.eclipse.org/articles/Article-Concurrency/jobs-api.html describes scheduling rules to a certain degree. If you want to take the easy way out, you could probably set the scheduling rule of your job to a MultiRule that contains your ClearCase rule and the workspace root (ResourcesPlugin.getWorkspace().getRoot()). This will give reduced concurrency during the refresh but should work. To get maximum concurrency, you would need to determine the subset of projects that the operation is being performed on and put those in the multi rule instead of the workspace root.

Michael

On Tue, Mar 17, 2009 at 3:43 AM, Mikael Petterson <mikael.petterson@xxxxxxxxxxxx> wrote:

I have found 2 static classes in my xPlugin class.

They are:

/** the scheduling rule for the whole clearcase engine */
        public static final ISchedulingRule RULE_CLEARCASE_ENGING = new ISchedulingRule() {

                public boolean contains(ISchedulingRule rule) {
                        return RULE_CLEARCASE_ENGING == rule;
                }

                public boolean isConflicting(ISchedulingRule rule) {
                        return RULE_CLEARCASE_ENGING == rule;
                }
        };

        /** the scheduling rule for the refresh jobs */
        public static final ISchedulingRule RULE_CLEARCASE_REFRESH = new ISchedulingRule() {

                public boolean contains(ISchedulingRule rule) {
                        // can contain engine and refresh rules
                        return RULE_CLEARCASE_ENGING == rule
                                        || RULE_CLEARCASE_REFRESH == rule;
                }

                public boolean isConflicting(ISchedulingRule rule) {
                        // conflict with engine
                        // conflict with refresh
                        // conflict with workspace (fix for 1055293)
                        return RULE_CLEARCASE_ENGING == rule
                                        || RULE_CLEARCASE_REFRESH == rule
                                        || getWorkspace().getRuleFactory().buildRule() == rule;
                }
        };

I also see that I set the RULE_CLEARCASE_REFRESH rule for my Job. I guess that this will be my outer rule.
Then when I added the following rule in my refresh state method that is run in the job:

                IResource resource = getStateCache().getResource();
                ISchedulingRule rule = ClearcasePlugin.getWorkspace()
                                .getRuleFactory().refreshRule(resource);
                try {
                        jobManager.beginRule(rule, monitor);
                        resource.refreshLocal(IResource.DEPTH_ZERO,                                     new SubProgressMonitor(monitor, 1));

                } catch (CoreException e) {
                        e.printStackTrace();

                } finally {
                        jobManager.endRule(rule);
                }

I get the following error:

!ENTRY org.eclipse.core.resources 4 1 2009-03-05 14:14:34.750 !MESSAGE Internal Error !STACK 0
java.lang.IllegalArgumentException: Attempted to beginRule:
F/Drive_U/src/com/quantel/QuentinManager, does not match outer scope rule:
net.sourceforge.eclipseccase.ClearcasePlugin$2@16cf69a

I guess that the outer scope is the RULE_CLEARCASE_REFRESH.

Is there anyone that can explain how these rules work?

Cheers,

//mike




_______________________________________________
platform-cvs-dev mailing list
platform-cvs-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-cvs-dev