| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <link rel="canonical" href="https://ignite.apache.org/releases/2.10.0/javadoc/org/apache/ignite/IgniteLock.html" /> |
| <META NAME="ROBOTS" CONTENT="NOINDEX"> |
| <!-- Yandex.Metrika counter --> |
| <script type="text/javascript" > |
| (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; |
| m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)}) |
| (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); |
| |
| ym(72949126, "init", { |
| clickmap:true, |
| trackLinks:true, |
| accurateTrackBounce:true, |
| webvisor:true |
| }); |
| </script> |
| <noscript><div><img src="https://mc.yandex.ru/watch/72949126" style="position:absolute; left:-9999px;" alt="" /></div></noscript> |
| <!-- /Yandex.Metrika counter --> |
| <script type='text/javascript'> |
| window.__lo_site_id = 284467; |
| |
| (function() { |
| var wa = document.createElement('script'); wa.type = 'text/javascript'; wa.async = true; |
| wa.src = 'https://d10lpsik1i8c69.cloudfront.net/w.js'; |
| var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wa, s); |
| })(); |
| </script> |
| |
| <!-- Generated by javadoc (1.8.0_261) on Thu Mar 11 02:15:42 MSK 2021 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>IgniteLock (Ignite 2.10.0)</title> |
| <meta name="date" content="2021-03-11"> |
| <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../script.js"></script> |
| <link rel='shortcut icon' href='https://ignite.apache.org/favicon.ico'/> |
| |
| <script async src="https://www.googletagmanager.com/gtag/js?id=UA-61232409-1"></script> |
| <script> |
| window.dataLayer = window.dataLayer || []; |
| function gtag(){dataLayer.push(arguments);} |
| gtag('js', new Date()); |
| |
| gtag('config', 'UA-61232409-1'); |
| </script></head> |
| |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="IgniteLock (Ignite 2.10.0)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/IgniteLock.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../index-all.html">Index</a></li> |
| <li><a href="../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../org/apache/ignite/IgniteJdbcThinDriver.html" title="class in org.apache.ignite"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../org/apache/ignite/IgniteLogger.html" title="interface in org.apache.ignite"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?org/apache/ignite/IgniteLock.html" target="_top">Frames</a></li> |
| <li><a href="IgniteLock.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.ignite</div> |
| <h2 title="Interface IgniteLock" class="title">Interface IgniteLock</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Superinterfaces:</dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang">AutoCloseable</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true" title="class or interface in java.util.concurrent.locks">Lock</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public interface <span class="typeNameLabel">IgniteLock</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true" title="class or interface in java.util.concurrent.locks">Lock</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a></pre> |
| <div class="block">This interface provides a rich API for working with distributed reentrant locks. |
| <p> |
| <h1 class="header">Functionality</h1> |
| Distributed reentrant lock provides functionality similar to <code>java.util.concurrent.ReentrantLock</code>. |
| <h1 class="header">Creating Distributed ReentrantLock</h1> |
| Instance of cache reentrant lock can be created by calling the following method: |
| <a href="../../../org/apache/ignite/Ignite.html#reentrantLock-java.lang.String-boolean-boolean-boolean-"><code>Ignite.reentrantLock(String, boolean, boolean, boolean)</code></a>. |
| <h1 class="header">Protection from failover</h1> |
| Ignite lock can automatically recover from node failure. |
| <ul> |
| <li>If failoverSafe flag is set to true upon creation, |
| in case a node owning the lock fails, lock will be automatically released and become available for threads on other |
| nodes to acquire. No exception will be thrown. |
| <li>If failoverSafe flag is set to false upon creation, |
| in case a node owning the lock fails, <code>IgniteException</code> will be thrown on every other node attempting to |
| perform any operation on this lock. No automatic recovery will be attempted, |
| and lock will be marked as broken (i.e. unusable), which can be checked using the method #isBroken(). |
| Broken lock cannot be reused again. |
| </ul> |
| |
| <h1 class="header">Implementation issues</h1> |
| Ignite lock comes in two flavours: fair and non-fair. Non-fair lock assumes no ordering should be imposed |
| on acquiring threads; in case of contention, threads from all nodes compete for the lock once the lock is released. |
| In most cases this is the desired behaviour. However, in some cases, using the non-fair lock can lead to uneven load |
| distribution among nodes. |
| Fair lock solves this issue by imposing strict FIFO ordering policy at a cost of an additional transaction. |
| This ordering does not guarantee fairness of thread scheduling (similar to <code>java.util.concurrent.ReentrantLock</code>). |
| Thus, one of many threads on any node using a fair lock may obtain it multiple times in succession while other |
| active threads are not progressing and not currently holding the lock. Also note that the untimed tryLock method |
| does not honor the fairness setting. It will succeed if the lock is available even if other threads are waiting. |
| |
| </p> |
| As a rule of thumb, whenever there is a reasonable time window between successive calls to release and acquire |
| the lock, non-fair lock should be preferred: |
| |
| <pre> <code> |
| while(someCondition){ |
| // do anything |
| lock.lock(); |
| try{ |
| // ... |
| } |
| finally { |
| lock.unlock(); |
| } |
| } |
| </code></pre> |
| |
| If successive calls to release/acquire are following immediately, |
| e.g. |
| |
| <pre> <code> |
| while(someCondition){ |
| lock.lock(); |
| try { |
| // do something |
| } |
| finally { |
| lock.unlock(); |
| } |
| } |
| </code></pre> |
| |
| using the fair lock is reasonable in order to allow even distribution of load among nodes |
| (although overall throughput may be lower due to increased overhead).</div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#close--">close</a></span>()</code> |
| <div class="block">Removes reentrant lock.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#getHoldCount--">getHoldCount</a></span>()</code> |
| <div class="block">Queries the number of holds on this lock by the current thread.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="../../../org/apache/ignite/IgniteCondition.html" title="interface in org.apache.ignite">IgniteCondition</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#getOrCreateCondition-java.lang.String-">getOrCreateCondition</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name)</code> |
| <div class="block">Returns a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Condition.html?is-external=true" title="class or interface in java.util.concurrent.locks"><code>Condition</code></a> instance for use with this |
| <a href="../../../org/apache/ignite/IgniteLock.html" title="interface in org.apache.ignite"><code>IgniteLock</code></a> instance.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#getWaitQueueLength-org.apache.ignite.IgniteCondition-">getWaitQueueLength</a></span>(<a href="../../../org/apache/ignite/IgniteCondition.html" title="interface in org.apache.ignite">IgniteCondition</a> condition)</code> |
| <div class="block">Returns an estimate of the number of threads on this node that are waiting on the |
| given condition associated with this lock.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#hasQueuedThread-java.lang.Thread-">hasQueuedThread</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true" title="class or interface in java.lang">Thread</a> thread)</code> |
| <div class="block">Queries whether the given thread is waiting to acquire this |
| lock.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#hasQueuedThreads--">hasQueuedThreads</a></span>()</code> |
| <div class="block">Queries whether any threads on this node are waiting to acquire this lock.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#hasWaiters-org.apache.ignite.IgniteCondition-">hasWaiters</a></span>(<a href="../../../org/apache/ignite/IgniteCondition.html" title="interface in org.apache.ignite">IgniteCondition</a> condition)</code> |
| <div class="block">Queries whether any threads on this node are waiting on the given condition |
| associated with this lock.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#isBroken--">isBroken</a></span>()</code> |
| <div class="block">Returns true if any node that owned the locked failed before releasing the lock.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#isFailoverSafe--">isFailoverSafe</a></span>()</code> |
| <div class="block">Returns <code>true</code> if this lock is safe to use after node failure.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#isFair--">isFair</a></span>()</code> |
| <div class="block">Returns <code>true</code> if this lock is fair.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#isHeldByCurrentThread--">isHeldByCurrentThread</a></span>()</code> |
| <div class="block">Queries if this lock is held by the current thread.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#isLocked--">isLocked</a></span>()</code> |
| <div class="block">Queries if this lock is held by any thread on any node.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#lock--">lock</a></span>()</code> |
| <div class="block">Acquires the distributed reentrant lock.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#lockInterruptibly--">lockInterruptibly</a></span>()</code> |
| <div class="block">Acquires the lock unless the current thread is |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt--" title="class or interface in java.lang">interrupted</a>.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#name--">name</a></span>()</code> |
| <div class="block">Name of atomic reentrant lock.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Condition.html?is-external=true" title="class or interface in java.util.concurrent.locks">Condition</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#newCondition--">newCondition</a></span>()</code> |
| <div class="block">This method is not supported in IgniteLock, |
| Any invocation of this method will result in <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang">UnsupportedOperationException</a>.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#removed--">removed</a></span>()</code> |
| <div class="block">Gets status of reentrant lock.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#tryLock--">tryLock</a></span>()</code> |
| <div class="block">Acquires the lock only if it is free at the time of invocation.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#tryLock-long-java.util.concurrent.TimeUnit-">tryLock</a></span>(long timeout, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</a> unit)</code> |
| <div class="block">Acquires the lock if it is not held by another thread within the given |
| waiting time and the current thread has not been |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt--" title="class or interface in java.lang">interrupted</a>.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteLock.html#unlock--">unlock</a></span>()</code> |
| <div class="block">Releases the lock.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="name--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>name</h4> |
| <pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name()</pre> |
| <div class="block">Name of atomic reentrant lock.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>Name of atomic reentrant lock.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="lock--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>lock</h4> |
| <pre>void lock() |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Acquires the distributed reentrant lock. |
| |
| <p>Acquires the lock if it is not held by another thread and returns |
| immediately, setting the lock hold count to one. |
| |
| <p>If the current thread already holds this lock then the hold count |
| is incremented by one and the method returns immediately. |
| |
| <p>If the lock is held by another thread then the |
| current thread becomes disabled for thread scheduling |
| purposes and lies dormant until one of four things happens: |
| |
| <ul> |
| |
| <li>The lock is acquired by the current thread; or |
| |
| <li>Lock is broken (any node failed while owning this lock), and lock is created in |
| non-failoverSafe mode. |
| |
| <li>Local node is stopped.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true#lock--" title="class or interface in java.util.concurrent.locks">lock</a></code> in interface <code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true" title="class or interface in java.util.concurrent.locks">Lock</a></code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the node is stopped or broken in non-failoverSafe mode</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="lockInterruptibly--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>lockInterruptibly</h4> |
| <pre>void lockInterruptibly() |
| throws <a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite">IgniteInterruptedException</a>, |
| <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Acquires the lock unless the current thread is |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt--" title="class or interface in java.lang">interrupted</a>. |
| |
| <p>Acquires the lock if it is not held by another thread and returns |
| immediately, setting the lock hold count to one. |
| |
| <p>If the current thread already holds this lock then the hold count |
| is incremented by one and the method returns immediately. |
| |
| <p>If the lock is held by another thread then the |
| current thread becomes disabled for thread scheduling |
| purposes and lies dormant until one of four things happens: |
| |
| <ul> |
| |
| <li>The lock is acquired by the current thread; or |
| |
| <li>Some other thread <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt--" title="class or interface in java.lang">interrupts</a> the |
| current thread. |
| |
| <li>Lock is broken (any node failed while owning this lock), and lock is created in |
| non-failoverSafe mode. |
| |
| <li>Local node is stopped. |
| |
| </ul> |
| |
| <p>If the lock is acquired by the current thread then the lock hold |
| count is set to one. |
| |
| <p>If the current thread: |
| |
| <ul> |
| |
| <li>has its interrupted status set on entry to this method; or |
| |
| <li>is <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt--" title="class or interface in java.lang">interrupted</a> while acquiring |
| the lock; or |
| |
| then <a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite"><code>IgniteInterruptedException</code></a> is thrown and the current thread's |
| interrupted status is cleared. |
| |
| </ul> |
| |
| <p><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite"><code>IgniteException</code></a> is thrown in case: |
| |
| <ul> |
| |
| <li>the lock is broken before or during the attempt to acquire this lock; or |
| |
| <li>local node is stopped, |
| |
| </ul> |
| |
| <p>In this implementation, as this method is an explicit |
| interruption point, preference is given to responding to the |
| interrupt over normal or reentrant acquisition of the lock.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true#lockInterruptibly--" title="class or interface in java.util.concurrent.locks">lockInterruptibly</a></code> in interface <code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true" title="class or interface in java.util.concurrent.locks">Lock</a></code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite">IgniteInterruptedException</a></code> - if the current thread is interrupted</dd> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is broken in non-failoverSafe mode (any node failed while owning this lock), |
| or local node is stopped</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="tryLock--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>tryLock</h4> |
| <pre>boolean tryLock() |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Acquires the lock only if it is free at the time of invocation. |
| |
| <p>Acquires the lock if it is available and returns immediately |
| with the value <code>true</code>. |
| If the lock is not available then this method will return |
| immediately with the value <code>false</code>. |
| |
| <p>A typical usage idiom for this method would be: |
| <pre> <code> |
| Lock lock = ...; |
| if (lock.tryLock()) { |
| try { |
| // manipulate protected state |
| } finally { |
| lock.unlock(); |
| } |
| } else { |
| // perform alternative actions |
| }</code></pre> |
| |
| This usage ensures that the lock is unlocked if it was acquired, and |
| doesn't try to unlock if the lock was not acquired. |
| |
| If node is stopped, or any node failed while owning the lock in non-failoverSafe mode, |
| then <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite"><code>IgniteException</code></a> is thrown.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true#tryLock--" title="class or interface in java.util.concurrent.locks">tryLock</a></code> in interface <code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true" title="class or interface in java.util.concurrent.locks">Lock</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if the lock was acquired and |
| <code>false</code> otherwise</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if node is stopped, or lock is already broken in non-failover safe mode</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="tryLock-long-java.util.concurrent.TimeUnit-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>tryLock</h4> |
| <pre>boolean tryLock(long timeout, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</a> unit) |
| throws <a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite">IgniteInterruptedException</a>, |
| <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Acquires the lock if it is not held by another thread within the given |
| waiting time and the current thread has not been |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt--" title="class or interface in java.lang">interrupted</a>. |
| |
| <p>Acquires the lock if it is not held by another thread and returns |
| immediately with the value <code>true</code>, setting the lock hold count |
| to one. |
| |
| <p>If the current thread |
| already holds this lock then the hold count is incremented by one and |
| the method returns <code>true</code>. |
| |
| <p>If the lock is held by another thread then the |
| current thread becomes disabled for thread scheduling |
| purposes and lies dormant until one of five things happens: |
| |
| <ul> |
| |
| <li>The lock is acquired by the current thread; or |
| |
| <li>Some other thread <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt--" title="class or interface in java.lang">interrupts</a> |
| the current thread; or |
| |
| <li>Lock is broken (any node failed while owning this lock), and lock is created in |
| non-failoverSafe mode. |
| |
| <li>Local node is stopped. |
| |
| <li>The specified waiting time elapses |
| |
| </ul> |
| |
| <p>If the lock is acquired then the value <code>true</code> is returned and |
| the lock hold count is set to one. |
| |
| <p>If the current thread: |
| |
| <ul> |
| |
| <li>has its interrupted status set on entry to this method; or |
| |
| <li>is <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt--" title="class or interface in java.lang">interrupted</a> while |
| acquiring the lock; or |
| |
| </ul> |
| then <a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite"><code>IgniteInterruptedException</code></a> is thrown and the current thread's |
| interrupted status is cleared. |
| |
| <p><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite"><code>IgniteException</code></a> is thrown in case: |
| |
| <ul> |
| |
| <li>the lock is broken before or during the attempt to acquire this lock; or |
| |
| <li>local node is stopped, |
| |
| </ul> |
| |
| <p>If the specified waiting time elapses then the value <code>false</code> |
| is returned. If the time is less than or equal to zero, the method |
| will not wait at all. |
| |
| <p>In this implementation, as this method is an explicit |
| interruption point, preference is given to responding to the |
| interrupt over normal or reentrant acquisition of the lock, and |
| over reporting the elapse of the waiting time.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true#tryLock-long-java.util.concurrent.TimeUnit-" title="class or interface in java.util.concurrent.locks">tryLock</a></code> in interface <code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true" title="class or interface in java.util.concurrent.locks">Lock</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>timeout</code> - the time to wait for the lock</dd> |
| <dd><code>unit</code> - the time unit of the timeout argument</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if the lock was free and was acquired by the |
| current thread, or the lock was already held by the current |
| thread; and <code>false</code> if the waiting time elapsed before |
| the lock could be acquired</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite">IgniteInterruptedException</a></code> - if the current thread is interrupted</dd> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if node is stopped, or lock is already broken in non-failover safe mode</dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if the time unit is null</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="unlock--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>unlock</h4> |
| <pre>void unlock() |
| throws <a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite">IgniteInterruptedException</a></pre> |
| <div class="block">Releases the lock. |
| |
| If lock is not owned by current thread, then an <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalMonitorStateException.html?is-external=true" title="class or interface in java.lang"><code>IllegalMonitorStateException</code></a> is thrown. |
| If lock is already broken prior to invocation of this method, and |
| lock is created in non-failover safe mode, then <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite"><code>IgniteException</code></a> is thrown.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true#unlock--" title="class or interface in java.util.concurrent.locks">unlock</a></code> in interface <code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true" title="class or interface in java.util.concurrent.locks">Lock</a></code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalMonitorStateException.html?is-external=true" title="class or interface in java.lang">IllegalMonitorStateException</a></code> - if not owned by current thread</dd> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if node is stopped, or lock is already broken in non-failover safe mode</dd> |
| <dd><code><a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite">IgniteInterruptedException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getOrCreateCondition-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getOrCreateCondition</h4> |
| <pre><a href="../../../org/apache/ignite/IgniteCondition.html" title="interface in org.apache.ignite">IgniteCondition</a> getOrCreateCondition(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name) |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Returns a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Condition.html?is-external=true" title="class or interface in java.util.concurrent.locks"><code>Condition</code></a> instance for use with this |
| <a href="../../../org/apache/ignite/IgniteLock.html" title="interface in org.apache.ignite"><code>IgniteLock</code></a> instance. |
| |
| <ul> |
| |
| <li>If this lock is not held when any of the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Condition.html?is-external=true" title="class or interface in java.util.concurrent.locks"><code>Condition</code></a> |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Condition.html?is-external=true#await--" title="class or interface in java.util.concurrent.locks">waiting</a> or <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Condition.html?is-external=true#signal--" title="class or interface in java.util.concurrent.locks">signalling</a> methods are called, then an <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalMonitorStateException.html?is-external=true" title="class or interface in java.lang"><code>IllegalMonitorStateException</code></a> is thrown. |
| |
| <li>When the condition <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Condition.html?is-external=true#await--" title="class or interface in java.util.concurrent.locks">waiting</a> |
| methods are called the lock is released and, before they |
| return, the lock is reacquired and the lock hold count restored |
| to what it was when the method was called. |
| |
| <li>If a thread is <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt--" title="class or interface in java.lang">interrupted</a> |
| while waiting then the wait will terminate, an <a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite"><code>IgniteInterruptedException</code></a> will be thrown, and the thread's |
| interrupted status will be cleared. |
| |
| <li> Waiting threads are signalled in FIFO order. |
| |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - Name of the distributed condition object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the Condition object</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="newCondition--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newCondition</h4> |
| <pre><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Condition.html?is-external=true" title="class or interface in java.util.concurrent.locks">Condition</a> newCondition()</pre> |
| <div class="block">This method is not supported in IgniteLock, |
| Any invocation of this method will result in <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang">UnsupportedOperationException</a>. |
| Correct way to obtain Condition object is through method <a href="../../../org/apache/ignite/IgniteLock.html#getOrCreateCondition-java.lang.String-">getOrCreateCondition(String)</a></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true#newCondition--" title="class or interface in java.util.concurrent.locks">newCondition</a></code> in interface <code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html?is-external=true" title="class or interface in java.util.concurrent.locks">Lock</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getHoldCount--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getHoldCount</h4> |
| <pre>int getHoldCount() |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Queries the number of holds on this lock by the current thread.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the number of holds on this lock by the current thread, |
| or zero if this lock is not held by the current thread</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isHeldByCurrentThread--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isHeldByCurrentThread</h4> |
| <pre>boolean isHeldByCurrentThread() |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Queries if this lock is held by the current thread.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if current thread holds this lock and |
| <code>false</code> otherwise</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isLocked--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isLocked</h4> |
| <pre>boolean isLocked() |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Queries if this lock is held by any thread on any node. This method is |
| designed for use in monitoring of the system state, |
| not for synchronization control.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if any thread on this or any other node holds this lock and |
| <code>false</code> otherwise</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hasQueuedThreads--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hasQueuedThreads</h4> |
| <pre>boolean hasQueuedThreads() |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Queries whether any threads on this node are waiting to acquire this lock. Note that |
| because cancellations may occur at any time, a <code>true</code> |
| return does not guarantee that any other thread will ever |
| acquire this lock. This method is designed primarily for use in |
| monitoring of the system state.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if there may be other threads on this node waiting to |
| acquire the lock</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hasQueuedThread-java.lang.Thread-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hasQueuedThread</h4> |
| <pre>boolean hasQueuedThread(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true" title="class or interface in java.lang">Thread</a> thread) |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Queries whether the given thread is waiting to acquire this |
| lock. Note that because cancellations may occur at any time, a |
| <code>true</code> return does not guarantee that this thread |
| will ever acquire this lock. This method is designed primarily for use |
| in monitoring of the system state.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>thread</code> - the thread</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if the given thread is queued waiting for this lock</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if the thread is null</dd> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hasWaiters-org.apache.ignite.IgniteCondition-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hasWaiters</h4> |
| <pre>boolean hasWaiters(<a href="../../../org/apache/ignite/IgniteCondition.html" title="interface in org.apache.ignite">IgniteCondition</a> condition) |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Queries whether any threads on this node are waiting on the given condition |
| associated with this lock. Note that because timeouts and |
| interrupts may occur at any time, a <code>true</code> return does |
| not guarantee that a future <code>signal</code> will awaken any |
| threads. This method is designed primarily for use in |
| monitoring of the system state.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>condition</code> - the condition</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if there are any waiting threads on this node</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalMonitorStateException.html?is-external=true" title="class or interface in java.lang">IllegalMonitorStateException</a></code> - if this lock is not held</dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the given condition is |
| not associated with this lock</dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if the condition is null</dd> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getWaitQueueLength-org.apache.ignite.IgniteCondition-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getWaitQueueLength</h4> |
| <pre>int getWaitQueueLength(<a href="../../../org/apache/ignite/IgniteCondition.html" title="interface in org.apache.ignite">IgniteCondition</a> condition) |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Returns an estimate of the number of threads on this node that are waiting on the |
| given condition associated with this lock. Note that because |
| timeouts and interrupts may occur at any time, the estimate |
| serves only as an upper bound on the actual number of waiters. |
| This method is designed for use in monitoring of the system |
| state, not for synchronization control.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>condition</code> - the condition</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the estimated number of waiting threads on this node</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalMonitorStateException.html?is-external=true" title="class or interface in java.lang">IllegalMonitorStateException</a></code> - if this lock is not held</dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the given condition is |
| not associated with this lock</dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if the condition is null</dd> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isFailoverSafe--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isFailoverSafe</h4> |
| <pre>boolean isFailoverSafe()</pre> |
| <div class="block">Returns <code>true</code> if this lock is safe to use after node failure. |
| If not, IgniteInterruptedException is thrown on every other node after node failure.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if this reentrant lock has failoverSafe set true</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isFair--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isFair</h4> |
| <pre>boolean isFair()</pre> |
| <div class="block">Returns <code>true</code> if this lock is fair. Fairness flag can only be set on lock creation.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if this reentrant lock has fairness flag set true.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isBroken--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isBroken</h4> |
| <pre>boolean isBroken() |
| throws <a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Returns true if any node that owned the locked failed before releasing the lock.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if any node failed while owning the lock since the lock on this node was initialized.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - if the lock is not initialized or already removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="removed--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>removed</h4> |
| <pre>boolean removed()</pre> |
| <div class="block">Gets status of reentrant lock.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if reentrant lock was removed from cache, <code>false</code> in other case.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="close--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>close</h4> |
| <pre>void close()</pre> |
| <div class="block">Removes reentrant lock.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html?is-external=true#close--" title="class or interface in java.lang">close</a></code> in interface <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang">AutoCloseable</a></code></dd> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true#close--" title="class or interface in java.io">close</a></code> in interface <code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a></code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - If operation failed.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/IgniteLock.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../index-all.html">Index</a></li> |
| <li><a href="../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../org/apache/ignite/IgniteJdbcThinDriver.html" title="class in org.apache.ignite"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../org/apache/ignite/IgniteLogger.html" title="interface in org.apache.ignite"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?org/apache/ignite/IgniteLock.html" target="_top">Frames</a></li> |
| <li><a href="IgniteLock.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small><table width="100%" border="0" cellspacing=0 cellpadding=0 style="padding: 5px"> <tr> <td> <table style="padding-left: 0; margin: 0"> <tbody style="padding: 0; margin: 0"> <tr style="padding: 0; margin: 0"> <td> <a target=_blank href="https://ignite.apache.org"><nobr>2021 Copyright © Apache Software Foundation</nobr></a> </td> </tr> </tbody> </table> </td> <td width="100%" align="right" valign="center"> <a href="https://twitter.com/ApacheIgnite" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @ApacheIgnite</a> </td> </tr> <tr> <td colspan="2" valign="top" align="left"> <table style="padding-left: 0; margin: 0"> <tbody style="padding: 0; margin: 0"> <tr style="padding: 0; margin: 0"> <td> <b>Ignite Database and Caching Platform</b> </td> <td>: ver. <strong>2.10.0</strong> </td> </tr> <tr style="padding: 0; margin: 0"> <td> <b>Release Date</b> </td> <td>: March 10 2021 </td> </tr> </tbody> </table> </td> </tr> </table></small></p> |
| </body> |
| </html> |