[Logo] Space4J - Java Persistence
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Moderation Log] Moderation Log   [Register] Register / 
[Login] Login 
Consistent view  XML
Forum Index » General Questions
Author Message
xolotl



Joined: 31/10/2008 15:36:18
Messages: 2
Offline

Can I modify my data while someone else is reading it? Yes! Does that mean that readers might see the ground shift under them, e.g., while they are iterating over a collection?
saoj



Joined: 05/09/2008 13:26:12
Messages: 45
Offline

xolotl wrote:Can I modify my data while someone else is reading it? Yes! Does that mean that readers might see the ground shift under them, e.g., while they are iterating over a collection?


Good question. I am not an expert on java.util.concurrent collections. We would have to ask this question to Doug Lee. However I imagine that if you are iterating (reading) and someone else is modifying, the results are king of unpredictable. But you will NOT get a ConcurrentModificationException.

I wonder how relational database handles that situation... This topic is not clear to me, but I am willing to learn from the experts... It has to do with isolation level.



This message was edited 1 time. Last update was at 31/10/2008 15:55:02



-Sergio Oliveira Junior
xolotl



Joined: 31/10/2008 15:36:18
Messages: 2
Offline

But you will NOT get a ConcurrentModificationException.


That is just why I am worried: I wouldn't even know my results are a chimera!

As to what "real" dbs do, implementation will vary but they probably apply changes
to some "scratch" area, perhaps to a copy of the affected structures, which they then
swap atomically for the old one. It might take an extra level of indirection in your
scheme to do that but in principle it seems doable.

By the way, the fuss over simplistic designs like Prevayler or Space4j tends to obcure
the fact that there are fully-fledged transactional db engines designed to operate
in-memory although not in-process, an example that come to mind being TimesTen
(now an Oracle property). So you can have your cake an eat it, too.
saoj



Joined: 05/09/2008 13:26:12
Messages: 45
Offline

xolotl wrote:
By the way, the fuss over simplistic designs like Prevayler or Space4j tends to obcure
the fact that there are fully-fledged transactional db engines designed to operate
in-memory although not in-process, an example that come to mind being TimesTen
(now an Oracle property). So you can have your cake an eat it, too.


I agree. It is not about speed anymore, I would think. It is about a simple way to perform reads straight from collections.

SQL, JDBC Driver, ORM, connection pooling may be too much for many apps.

Prevayler had a not so good attitude that it was the salvation of the world and that databases were evil.

This was a joke in my personal opinion. Database are awesome!

Space4J is just another option...


-Sergio Oliveira Junior
 
Forum Index » General Questions
Go to:   
Powered by JForum 2.1.8 © JForum Team