|
![]() |
The readers and the writers want to access the same data. In order to allow
concurrency while ensuring the consistency of the readings, accesses to the
data have to be synchronized upon a specified policy. Thanks to ProActive, the
accesses are guaranteed to be allowed sequentially.
The implementation with ProActive uses 3 active objects : Reader, Writer, and the controller class (ReaderWriter).
using the readers script
ProActive starts a node (i.e. a JVM) on the current machine, and creates 3 Writer, 3 Reader, a ReaderWriter (the controller of the application) and a ReaderDisplay, that are active objects.
a GUI is started that illustrates the activities of the Reader and Writer objects.
What happens when priority is set to "reader priority" ?
in org.objectweb.proactive.examples.readers.ReaderWriter.java
More specifically, look at the routines in :
public void evenPolicy(org.objectweb.proactive.Service service)
public void readerPolicy(org.objectweb.proactive.Service service)
public void writerPolicy(org.objectweb.proactive.Service service)
Look at the inner class MyRequestFilterm
that implements org.objectweb.proactive.core.body.request.RequestFilter
How does it work?
For instance, let several writers go through at the same time.
- observe the Writer Policy policy before recompiling
- recompile (using compile.sh readers or compile.bat readers)
- observe that stub classes are regenerated and recompiled
- observe the difference due to the new synchronization policy : what happens now?
- correct the bug and recompile again ; check that everything is back to normal