[jboss-dev-forums] [Design of JBossCache] - Re: Implicit marshalled values - a better way of handling re
jason.greene@jboss.com
do-not-reply at jboss.com
Mon Jan 7 17:35:04 EST 2008
"bstansberry at jboss.com" wrote :
| With Hibernate entity caching there's no second node, as the value is a single Object[] representing the entity fields.
|
Even better, so in that case, you can just set the value to be Object[].
anonymous wrote :
| Some problems with this:
|
| 1) Can lead to deadlocks: node A updates entity 1, node B updates entity 2; they resolve to the same hashcode. Even with your UUID approach you can have that problem if A and B are inserting.
|
Thats not a deadlock, the updates would be serialized though. For a deadlock to occur, you have to update multiple entities in the same cache transaction in a different order, and even in that condition it would just be a timeout. The locking granularity is only as good as the hashcode algorithm, but I think that is reasonable. We would also need to detect the lack of a hashcode function, and provide our own (since the default is based off of identity, which does not work in a cluster).
anonymous wrote :
| 2) If you don't have two nodes per entity, putForExternalRead no longer works properly, since it uses the presence of the node to decide to quickly abort. That may be trivial to solve; I don't know.
|
I believe this can be solved by modifying putForExternalRead to not only check for node existence, but also key existence.
anonymous wrote :
| 3) With the 2 node solution, where does the UUID come from? These aren't sessions; each node in the cluster would need to come up with the same UUID for a given key.
|
In the 2 node solution, which does not seem necessary, the UUID does not need to be known by all nodes. It is generated once, for the entire lifespan of the second node. After that point all gets use the entity key, which is known, to retrieve the UUID that is stored as the value of the key on the first node. That UUID is then used to construct the FQN to the node containing the data.
anonymous wrote :
| Sorry, still jet-lagged; I can only raise problems today; no solutions :(
Keep them coming!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117743#4117743
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117743
More information about the jboss-dev-forums
mailing list