<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 24 Jul 2012, at 09:54, Galder Zamarreņo wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><blockquote type="cite"><blockquote type="cite"><br class="Apple-interchange-newline"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">IOW, the test now passes because the commit throws an exception in 4 out of 5 threads. But, the test could/should maybe work in such way that no exception was thrown and 4 out of 5 invocations returned false to the checks made (conditional remove returns false, or normal remove returns null).<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite">It is possible that multiple tx return the same non-null existing value - I've commented more on the JIRA.<br></blockquote><br>Is it possible under concurrent modification circumstances?<span class="Apple-converted-space">&nbsp;</span><br><br>If you have 5 concurrent removals, one should do the job and the others should be no-ops. IOW, 1/5 of the removes should return non-null and the other 4/5 should return null. This is not the case today.<br></div></span></blockquote><div><br></div><div>Even it is a bit counterintuitive, with optimistic transactions that's possible though.</div><div>For example:</div><div>tx1 and tx2 remove the (k,v) entry concurrently:</div><div>tx1.remove(k); // "v" is returned as that's what tx1 saw at this time</div><div>tx2.remove(k); // again "v" is returned, as tx1 hasn't committed anything yet (optimistic transactions)</div><div><br></div><div>Now during the commit time the writes to k are serialised between tx1 and tx2.</div><div>The only reliable way in which the user can get this behaviour is by forcing the write skew check &nbsp;through a get first (the workaround describe din ISPN-2164).</div><div><br></div><div>Now thinking about it, the fact that we return the value to the user during the put is equivalently to a read so it might make sense to perform the write skew check for keys that are put into the cache when unsafeReturn is false (the default) and when the Flag.SKIP_REMOTE_LOOKUP is not used. What do you think?</div><div><br></div></div><br></body></html>