<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 26 Apr 2012, at 13:05, Dan Berindei wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>What seems to be missing is an overload with a custom timeout, it may<br>be useful to try locking with a shorter timeout in the first attempt<br>(maybe even 0?) like we do for deadlock detection.<br></div></blockquote><div><br></div><div>There is a flag for that.</div><div><br></div><div><a href="https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/context/Flag.java#L79">https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/context/Flag.java#L79</a></div><div><br></div><br><blockquote type="cite"><div><br>But that is a bit orthogonal, as it would be useful for write<br>operations as well, so maybe a 6.0 idea...<br><br><br>On Thu, Apr 26, 2012 at 2:55 PM, Mircea Markus &lt;<a href="mailto:mircea.markus@jboss.com">mircea.markus@jboss.com</a>&gt; wrote:<br><blockquote type="cite">On 26 Apr 2012, at 14:42, Erik Salter wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">FWIW, I implement a TryLock like this:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">boolean success = cache.getAdvancedCache()<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.withFlags(Flag.FAIL_SILENTLY).lock(key);<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">+1, this seems like solving the issue.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Regards,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Erik<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-----Original Message-----<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">From: <a href="mailto:infinispan-dev-bounces@lists.jboss.org">infinispan-dev-bounces@lists.jboss.org</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">[mailto:infinispan-dev-bounces@lists.jboss.org] On Behalf Of Galder<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Zamarreņo<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Sent: Thursday, April 26, 2012 6:59 AM<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">To: Mircea Markus<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Cc: infinispan -Dev List<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Subject: [infinispan-dev] Time for a tryLock() ?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Looks like rolling back the transaction when a lock timeout is encountered<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">can be problematic: <a href="https://community.jboss.org/message/731307#731307">https://community.jboss.org/message/731307#731307</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Maybe time to implement a tryLock() that attempts to acquire the lock but<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">does not rollback the transaction if it cannot acquire it?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thoughts?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">--<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Galder Zamarreņo<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Sr. Software Engineer<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Infinispan, JBoss Cache<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">infinispan-dev mailing list<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">infinispan-dev mailing list<br></blockquote><blockquote type="cite"><a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br></blockquote><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br></blockquote><br>_______________________________________________<br>infinispan-dev mailing list<br><a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/infinispan-dev<br></div></blockquote></div><br><div apple-content-edited="true">
<div><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div><a href="http://twitter.com/maniksurtani">twitter.com/maniksurtani</a></div><div><br></div><div>Lead, Infinispan</div><div><a href="http://www.infinispan.org">http://www.infinispan.org</a></div><div><br></div></div><br class="Apple-interchange-newline">
</div>
<br></body></html>