[Yanel-dev] Concurrent Read Write Locks

basZero baszero at gmail.com
Wed May 30 14:55:57 CEST 2012


Hi Michael,
i can have a look at my mails and I'll send them to you again.

Your suggested behaviour looks good to me, although the waiting write for
all active reads is probably not that easy to implement.

Another very important aspect is to consider the correct scope:
- global files (e.g. a data file that can be modified by any user) must use
a LOCK object of global scope (that's easy, it's a public static final
Object GLOBAL_LOCK = new Object();)

- user specific files (e.g. user profile extension), files that are
modified by the same user, always, such modifications do not need to be
synchronized globally, but within the session. For Zwischengas I have
implemented a nice helper class which uses an object stored in the user's
session which gets used for session-scoped synchronization.

If you are planning to draft a design for this, I will spend some time to
review it, if you want. Or we can have another tech-lunch together :)

Cheers
Balz

On Wed, May 30, 2012 at 2:43 PM, Michael Wechner
<michael.wechner at wyona.com>wrote:

> Hi Balz
>
> I remember that you once suggested how we should improve concurrent
> read/write operations, but
> unfortunately I cannot find your email anymore.
>
> I think the behaviour should be as follows:
>
> - Concurrent read operations do not block each other
> - If a thread wants to write, then it first needs to wait until all
> current read operations have finished
> - A write operation blocks new read requests until the writing has finished
>
> It seems to me the following articles describe the solution quite nicely
>
> http://www.javalobby.org/java/**forums/t45090.html<http://www.javalobby.org/java/forums/t45090.html>
> http://tutorials.jenkov.com/**java-concurrency/read-write-**locks.html<http://tutorials.jenkov.com/java-concurrency/read-write-locks.html>
>
> WDYT?
>
> As an alternative we could also implement the functionality, that if a
> repository has revisions enabled and
> if revisions are actually being created, that the read process always
> accesses the most recent revision, which
> would normally be the same as accessing the actuall node. Of course the
> creation of the revision would also have to be locked.
>
> Thanks
>
> Michael
> --
> Yanel-development mailing list Yanel-development at wyona.com
> http://lists.wyona.org/cgi-**bin/mailman/listinfo/yanel-**development<http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wyona.org/pipermail/yanel-development/attachments/20120530/56d15f49/attachment.html>


More information about the Yanel-development mailing list