This content has been marked as final.
Show 3 replies
-
1. Re: Is possible to get negative count of cache entry
matlach Apr 12, 2012 10:30 PM (in response to dex80526)Hi dex,
Have a look at the SizeCommand implementation :
org.infinispan.commands.read
public class SizeCommand extends AbstractLocalCommand implements VisitableCommand { @Override public Integer perform(InvocationContext ctx) throws Throwable { if (noTxModifications(ctx)) { return container.size(); } int size = container.size(); for (CacheEntry e: ctx.getLookedUpEntries().values()) { if (e.isCreated()) { size ++; } else if (e.isRemoved()) { size --; } } return Math.max(size, 0); } }
It's definitely impossible to obtain a negative value.
For the performance impact, by reading the code I'm having trouble figuring it out since the size command is replicated across the cluster since it's flagged by both LocalCommand and VisitableCommand (thus ReplicableCommand).
Guess a small breakpoint here in debug and you'll find really soon
-
2. Re: Is possible to get negative count of cache entry
dex80526 Apr 12, 2012 10:55 PM (in response to matlach)thanks for the response. I'll do a debug session as you suggested.
-
3. Re: Is possible to get negative count of cache entry
galder.zamarreno Apr 16, 2012 5:06 AM (in response to matlach)Thx Mathieu for helping out!