Hi Sergio,
Your description of the behavior is correct. I guess its a matter of
the exact meaning of the two flags as to whether this is the intended
behavior or not. I'd tend to side with you here and declare it a bug
as in my mind a non present mapping isn't local.
I guess the correct code would be something like:
if (val == null) {
//non present mappings
if (lockStrategy.allowNonCoherentReadsForNonExistentMapping())
return null;
//else drop through
} else if (! (val instanceof ObjectID)) {
//present, locally faulted mappings
if (lockStrategy.allowNonCoherentReadsForLocalEntries()) return (V)
val;
//else drop through
} else {
//present, non-locally faulted mappings
//always drop through
}
...continue to do fully locked stuff
If you could file a bug in JIRA against tim-concurrent-collections
that would be great.
Thanks,
Chris
On Jan 12, 2010, at 2:02 AM, Sergio Bossa wrote:
Hi guys,
I configured my ConcurrentDistributedMap with a HashcodeLockStrategy
allowing "NonCoherentReadsForLocalEntries": my understanding is that
after calling ConcurrentDistributedMap#get(key) method, it will
locally check if there's an object at the given key, and if it is
found and is not an ObjectID, it gets returned, otherwise (if not
found or instanceof ObjectID), it gets loaded from the tc master.
However, it sometimes returns null *without* ever trying to load
from master.
That's apparently because there seems to be a bug in
ConcurrentDistributedMapDso#get() method.
The following if-clause:
if (val == null &&
lockStrategy.allowNonCoherentReadsForNonExistentMapping()) {
// Mapping not present and we are allowed to perform fast
non-coherent reads for non-existent mapping.
return null;
} else if (! (val instanceof ObjectID) &&
lockStrategy.allowNonCoherentReadsForLocalEntries()) {
// Mapping present and is faulted in and we are allowed to
perform fast non-coherent reads for locally present mapping.
return (V) val;
}
Actually returns null (on second if) when val is null even if
allowNonCoherentReadsForNonExistentMapping is false but
allowNonCoherentReadsForLocalEntries is true.
Is that correct?
Thanks,
Cheers,
Sergio B.
--
Sergio Bossa
Software Passionate and Open Source Enthusiast.
URL: http://www.linkedin.com/in/sergiob
_______________________________________________
tc-dev mailing list
tc-dev@lists.terracotta.org
http://lists.terracotta.org/mailman/listinfo/tc-dev
_______________________________________________
tc-dev mailing list
tc-dev@lists.terracotta.org
http://lists.terracotta.org/mailman/listinfo/tc-dev