Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Can I use ISchedulingRule as a explicit lock?
Can I use ISchedulingRule as a explicit lock? [message #913091] Fri, 14 September 2012 18:59 Go to next message
jin lan is currently offline jin lanFriend
Messages: 3
Registered: September 2012
Junior Member
If I have this code:


class Sample{
    private Object _lock=new Object();
    public void someMethod(){
        synchronized(_lock){
            doSomething();
        }
    }
}



Then I wanna use it in this way:


class Sample{
    private ISchedulingRule _lock=new SomeSchedulingRule();
    public void someMethod(){
        try{
            Job.getManager().beginRule(_lock);
            doSomething();
        }finally{
            Job.getManager().endRule(_lock);
        }
    }
}



Can I do it? And should I do it?
The most important thing, does IJobManager.beginRule and IJobManager.endRule provide memory visibility?

[Updated on: Fri, 14 September 2012 18:59]

Report message to a moderator

Re: Can I use ISchedulingRule as a explicit lock? [message #913128 is a reply to message #913091] Fri, 14 September 2012 20:32 Go to previous message
Libor Jelinek is currently offline Libor JelinekFriend
Messages: 143
Registered: January 2012
Location: Prague, Czech Rep.
Senior Member

Hi Jin,
repost this question to eclipse.platform forum instead where it will be
rather answered. Jobs API is a part of Eclipse Platform project.

Have a nice day!
Libor

On 09/14/2012 08:59 PM, jin lan wrote:
> If I have this code:
>
>
>
> class Sample{
> private Object _lock=new Object();
> public void someMethod(){
> synchronized(_lock){
> doSomething();
> }
> }
> }
>
>
>
> Then I wanna use it in this way:
>
>
>
> class Sample{
> private ISchedulingRule _lock=new SomeSchedulingRule();
> public void someMethod(){
> try{
> Job.getManager().beginRule(_lock);
> doSomething();
> }finally{
> Job.getManager().endRule(_lock);
> }
> }
> }
>
>
>
> Can I do it? And should I do it?
> The most important thing does IJobManager.beginRule and
> IJobManager.endRule provide memory visibility?
>
Previous Topic:ssh console error: key_verify failed for server_host_key
Next Topic:Import-Package version matching
Goto Forum:
  


Current Time: Sat Apr 20 04:12:48 GMT 2024

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

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

Back to the top