jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Adamovich <andrey.adamov...@yahoo.com>
Subject Re: [jr3] Synchronized sessions
Date Fri, 26 Feb 2010 08:09:32 GMT

+1 for all that Thomas said.


From: Thomas Müller <thomas.mueller@day.com>
To: dev@jackrabbit.apache.org
Sent: Thu, 25 February, 2010 22:24:13
Subject: Re: [jr3] Synchronized sessions


> http://issues.apache.org/jira/browse/JCR-2443.

Unfortunately this bug doesn't have a test case. Also I didn't find a
thread dump that shows what the problem was exactly. I can't say what
was the problem there.

Observation is definitely an area where synchronization can
potentially lead to deadlocks. Maybe observation needs to use its own
session(s) so that it can't block. This is not a new issue however:
most writes are already synchronized (not all writes however).

I'm hesitant to change synchronization with the current
implementation: doing that would very likely lead to Java level
deadlocks. We need to make sure synchronization is always done on the
same level, and in the same order. With the current implementation,
that's challenging.

Of course performance and concurrency is very important. But the
current approach (mutable data structures, some writes are
synchronized) is quite dangerous. Instead, immutable data structures
should be used, at least for values and objects in the shared cache.
Everything else should be properly synchronized if mutable, or - if
that's too slow - the proper data structures should be used, for
example ConcurrentHashMap, CopyOnWriteArrayList, CopyOnWriteArraySet.


View raw message