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?