| <!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.6.0/javadoc/org/apache/ignite/IgniteSemaphore.html" /> |
| <META NAME="ROBOTS" CONTENT="NOINDEX"> |
| |
| <!-- Generated by javadoc (1.8.0_77) on Tue Jul 10 11:04:40 UTC 2018 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>IgniteSemaphore (Ignite 2.6.0)</title> |
| <meta name="date" content="2018-07-10"> |
| <link rel="stylesheet" type="text/css" href="../../../javadoc.css" title="Style"> |
| <script type="text/javascript" src="../../../script.js"></script> |
| |
| <script> |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| |
| ga('create', 'UA-61232409-1', 'auto'); |
| ga('send', 'pageview'); |
| |
| </script></head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="IgniteSemaphore (Ignite 2.6.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}; |
| 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/IgniteSemaphore.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 class="aboutLanguage">Ignite - In-Memory Data Fabric</div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../org/apache/ignite/IgniteScheduler.html" title="interface in org.apache.ignite"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../org/apache/ignite/IgniteServices.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/IgniteSemaphore.html" target="_top">Frames</a></li> |
| <li><a href="IgniteSemaphore.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 IgniteSemaphore" class="title">Interface IgniteSemaphore</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Superinterfaces:</dt> |
| <dd><a href="http://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="http://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public interface <span class="typeNameLabel">IgniteSemaphore</span> |
| extends <a href="http://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 semaphore. |
| <p> |
| <h1 class="header">Functionality</h1> |
| Distributed semaphore provides functionality similar to <code>java.util.concurrent.Semaphore</code>. |
| <h1 class="header">Creating Distributed Semaphore</h1> |
| Instance of cache semaphore can be created by calling the following method: |
| <a href="../../../org/apache/ignite/Ignite.html#semaphore-java.lang.String-int-boolean-boolean-"><code>Ignite.semaphore(String, int, boolean, boolean)</code></a>.</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/IgniteSemaphore.html#acquire--">acquire</a></span>()</code> |
| <div class="block">Acquires a permit from this semaphore, blocking until one is available, or the thread is <a href="http://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="i1" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#acquire-int-">acquire</a></span>(int permits)</code> |
| <div class="block">Acquires the given number of permits from this semaphore, blocking until all are available, or the thread is |
| <a href="http://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="i2" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#acquireUninterruptibly--">acquireUninterruptibly</a></span>()</code> |
| <div class="block">Acquires a permit from this semaphore, blocking until one is available.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#acquireUninterruptibly-int-">acquireUninterruptibly</a></span>(int permits)</code> |
| <div class="block">Acquires the given number of permits from this semaphore, blocking until all are available.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#availablePermits--">availablePermits</a></span>()</code> |
| <div class="block">Returns the current number of permits available in this semaphore.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#close--">close</a></span>()</code> |
| <div class="block">Removes this semaphore.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#drainPermits--">drainPermits</a></span>()</code> |
| <div class="block">Acquires and returns all permits that are immediately available.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#getQueueLength--">getQueueLength</a></span>()</code> |
| <div class="block">Returns an estimate of the number of nodes waiting to acquire.</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/IgniteSemaphore.html#hasQueuedThreads--">hasQueuedThreads</a></span>()</code> |
| <div class="block">Queries whether any threads are waiting to acquire.</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/IgniteSemaphore.html#isBroken--">isBroken</a></span>()</code> |
| <div class="block">Gets <code>broken</code> status of the semaphore.</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/IgniteSemaphore.html#isFailoverSafe--">isFailoverSafe</a></span>()</code> |
| <div class="block">Returns <code>true</code> if this semaphore is safe to use after node failure.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code><a href="http://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/IgniteSemaphore.html#name--">name</a></span>()</code> |
| <div class="block">Gets name of the semaphore.</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/IgniteSemaphore.html#release--">release</a></span>()</code> |
| <div class="block">Releases a permit, returning it to the semaphore.</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/IgniteSemaphore.html#release-int-">release</a></span>(int permits)</code> |
| <div class="block">Releases the given number of permits, returning them to the semaphore.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#removed--">removed</a></span>()</code> |
| <div class="block">Gets <code>removed</code> status of the semaphore.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#tryAcquire--">tryAcquire</a></span>()</code> |
| <div class="block">Acquires a permit from this semaphore, only if one is available at the time of invocation.</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/IgniteSemaphore.html#tryAcquire-int-">tryAcquire</a></span>(int permits)</code> |
| <div class="block">Acquires the given number of permits from this semaphore, only if all are available at the time of invocation.</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/IgniteSemaphore.html#tryAcquire-int-long-java.util.concurrent.TimeUnit-">tryAcquire</a></span>(int permits, |
| long timeout, |
| <a href="http://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 given number of permits from this semaphore, if all become available within the given waiting time |
| and the current thread has not been <a href="http://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="i18" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/ignite/IgniteSemaphore.html#tryAcquire-long-java.util.concurrent.TimeUnit-">tryAcquire</a></span>(long timeout, |
| <a href="http://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 a permit from this semaphore, if one becomes available within the given waiting time and the current |
| thread has not been <a href="http://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> |
| </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="http://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">Gets name of the semaphore.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>Name of the semaphore.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="acquire--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>acquire</h4> |
| <pre>void acquire() |
| throws <a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite">IgniteInterruptedException</a></pre> |
| <div class="block">Acquires a permit from this semaphore, blocking until one is available, or the thread is <a href="http://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 a permit, if one is available and returns immediately, reducing the number of available permits by |
| one. |
| |
| <p>If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies |
| dormant until one of two things happens: <ul> <li>Some other thread invokes the <a href="../../../org/apache/ignite/IgniteSemaphore.html#release--"><code>release()</code></a> method for this |
| semaphore and the current thread is next to be assigned a permit; or <li>Some other thread <a href="http://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. </ul> |
| |
| <p>If the current thread: <ul> <li>has its interrupted status set on entry to this method; or <li>is <a href="http://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 for a permit, </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.</div> |
| <dl> |
| <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> |
| </dl> |
| </li> |
| </ul> |
| <a name="acquireUninterruptibly--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>acquireUninterruptibly</h4> |
| <pre>void acquireUninterruptibly()</pre> |
| <div class="block">Acquires a permit from this semaphore, blocking until one is available. |
| |
| <p>Acquires a permit, if one is available and returns immediately, reducing the number of available permits by |
| one. |
| |
| <p>If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies |
| dormant until some other thread invokes the <a href="../../../org/apache/ignite/IgniteSemaphore.html#release--"><code>release()</code></a> method for this semaphore and the current thread is |
| next to be assigned a permit. |
| |
| <p>If the current thread is <a href="http://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 for a permit then it will |
| continue to wait, but the time at which the thread is assigned a permit may change compared to the time it would |
| have received the permit had no interruption occurred. When the thread does return from this method its |
| interrupt status will be set.</div> |
| </li> |
| </ul> |
| <a name="tryAcquire--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>tryAcquire</h4> |
| <pre>boolean tryAcquire()</pre> |
| <div class="block">Acquires a permit from this semaphore, only if one is available at the time of invocation. |
| |
| <p>Acquires a permit, if one is available and returns immediately, with the value <code>true</code>, reducing the |
| number of available permits by one. |
| |
| <p>If no permit is available then this method will return immediately with the value <code>false</code>.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if a permit was acquired and <code>false</code> otherwise</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="tryAcquire-long-java.util.concurrent.TimeUnit-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>tryAcquire</h4> |
| <pre>boolean tryAcquire(long timeout, |
| <a href="http://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></pre> |
| <div class="block">Acquires a permit from this semaphore, if one becomes available within the given waiting time and the current |
| thread has not been <a href="http://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 a permit, if one is available and returns immediately, with the value <code>true</code>, reducing the |
| number of available permits by one. |
| |
| <p>If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies |
| dormant until one of three things happens: <ul> <li>Some other thread invokes the <a href="../../../org/apache/ignite/IgniteSemaphore.html#release--"><code>release()</code></a> method for |
| this semaphore and the current thread is next to be assigned a permit; or <li>Some other thread <a href="http://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>The specified waiting time elapses. </ul> |
| |
| <p>If a permit is acquired then the value <code>true</code> is returned. |
| |
| <p>If the current thread: <ul> <li>has its interrupted status set on entry to this method; or <li>is <a href="http://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 to acquire a permit, </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>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.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>timeout</code> - the maximum time to wait for a permit</dd> |
| <dd><code>unit</code> - the time unit of the <code>timeout</code> argument</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if a permit was acquired and <code>false</code> if the waiting time elapsed before a permit was |
| 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> |
| </dl> |
| </li> |
| </ul> |
| <a name="acquireUninterruptibly-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>acquireUninterruptibly</h4> |
| <pre>void acquireUninterruptibly(int permits)</pre> |
| <div class="block">Acquires the given number of permits from this semaphore, blocking until all are available. |
| |
| <p>Acquires the given number of permits, if they are available, and returns immediately, reducing the number of |
| available permits by the given amount. |
| |
| <p>If insufficient permits are available then the current thread becomes disabled for thread scheduling purposes |
| and lies dormant until some other thread invokes one of the <a href="../../../org/apache/ignite/IgniteSemaphore.html#release--"><code>release</code></a> methods for this |
| semaphore, the current thread is next to be assigned permits and the number of available permits satisfies this |
| request. |
| |
| <p>If the current thread is <a href="http://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 for permits then it will |
| continue to wait and its position in the queue is not affected. When the thread does return from this method its |
| interrupt status will be set.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>permits</code> - the number of permits to acquire</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="http://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 <code>permits</code> is negative</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="availablePermits--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>availablePermits</h4> |
| <pre>int availablePermits()</pre> |
| <div class="block">Returns the current number of permits available in this semaphore. |
| |
| <p>This method is typically used for debugging and testing purposes.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the number of permits available in this semaphore</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="drainPermits--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>drainPermits</h4> |
| <pre>int drainPermits()</pre> |
| <div class="block">Acquires and returns all permits that are immediately available.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the number of permits acquired</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="release--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>release</h4> |
| <pre>void release()</pre> |
| <div class="block">Releases a permit, returning it to the semaphore. |
| |
| <p>Releases a permit, increasing the number of available permits by one. If any threads are trying to acquire a |
| permit, then one is selected and given the permit that was just released. That thread is (re)enabled for thread |
| scheduling purposes. |
| |
| <p>There is no requirement that a thread that releases a permit must have acquired that permit by calling <a href="../../../org/apache/ignite/IgniteSemaphore.html#acquire--"><code>acquire()</code></a>. Correct usage of a semaphore is established by programming convention in the application.</div> |
| </li> |
| </ul> |
| <a name="tryAcquire-int-long-java.util.concurrent.TimeUnit-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>tryAcquire</h4> |
| <pre>boolean tryAcquire(int permits, |
| long timeout, |
| <a href="http://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></pre> |
| <div class="block">Acquires the given number of permits from this semaphore, if all become available within the given waiting time |
| and the current thread has not been <a href="http://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 given number of permits, if they are available and returns immediately, with the value <code>true</code>, reducing the number of available permits by the given amount. |
| |
| <p>If insufficient permits are available then the current thread becomes disabled for thread scheduling purposes |
| and lies dormant until one of three things happens: <ul> <li>Some other thread invokes one of the <a href="../../../org/apache/ignite/IgniteSemaphore.html#release--"><code>release</code></a> methods for this semaphore, the current thread is next to be assigned permits and the number |
| of available permits satisfies this request; or <li>Some other thread <a href="http://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>The specified waiting time elapses. </ul> |
| |
| <p>If the permits are acquired then the value <code>true</code> is returned. |
| |
| <p>If the current thread: <ul> <li>has its interrupted status set on entry to this method; or <li>is <a href="http://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 to acquire the permits, </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. Any permits that were to be assigned to this |
| thread, are instead assigned to other threads trying to acquire permits, as if the permits had been made |
| available by a call to <a href="../../../org/apache/ignite/IgniteSemaphore.html#release--"><code>release()</code></a>. |
| |
| <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. Any permits that were to be assigned to this thread, are instead |
| assigned to other threads trying to acquire permits, as if the permits had been made available by a call to |
| <a href="../../../org/apache/ignite/IgniteSemaphore.html#release--"><code>release()</code></a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>permits</code> - the number of permits to acquire</dd> |
| <dd><code>timeout</code> - the maximum time to wait for the permits</dd> |
| <dd><code>unit</code> - the time unit of the <code>timeout</code> argument</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if all permits were acquired and <code>false</code> if the waiting time elapsed before all |
| permits were 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="http://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 <code>permits</code> is negative</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="tryAcquire-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>tryAcquire</h4> |
| <pre>boolean tryAcquire(int permits)</pre> |
| <div class="block">Acquires the given number of permits from this semaphore, only if all are available at the time of invocation. |
| |
| <p>Acquires the given number of permits, if they are available, and returns immediately, with the value <code>true</code>, reducing the number of available permits by the given amount. |
| |
| <p>If insufficient permits are available then this method will return immediately with the value <code>false</code> |
| and the number of available permits is unchanged. |
| |
| <p>If you want to honor the failoverSafe setting, then use <a href="../../../org/apache/ignite/IgniteSemaphore.html#tryAcquire-int-long-java.util.concurrent.TimeUnit-"><code>tryAcquire(permits, 0, TimeUnit.SECONDS) </code></a> which is almost equivalent (it also detects interruption).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>permits</code> - the number of permits to acquire</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if the permits were acquired and <code>false</code> otherwise</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="http://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 <code>permits</code> is negative</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="acquire-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>acquire</h4> |
| <pre>void acquire(int permits) |
| throws <a href="../../../org/apache/ignite/IgniteInterruptedException.html" title="class in org.apache.ignite">IgniteInterruptedException</a></pre> |
| <div class="block">Acquires the given number of permits from this semaphore, blocking until all are available, or the thread is |
| <a href="http://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 given number of permits, if they are available, and returns immediately, reducing the number of |
| available permits by the given amount. |
| |
| <p>If insufficient permits are available then the current thread becomes disabled for thread scheduling purposes |
| and lies dormant until one of two things happens: <ul> <li>Some other thread invokes one of the <a href="../../../org/apache/ignite/IgniteSemaphore.html#release--"><code>release</code></a> methods for this semaphore, the current thread is next to be assigned permits and the number of |
| available permits satisfies this request; or <li>Some other thread <a href="http://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. </ul> |
| |
| <p>If the current thread: <ul> <li>has its interrupted status set on entry to this method; or <li>is <a href="http://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 for a permit, </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. Any permits that were to be assigned to this thread are |
| instead assigned to other threads trying to acquire permits, as if permits had been made available by a call to |
| <a href="../../../org/apache/ignite/IgniteSemaphore.html#release--"><code>release()</code></a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>permits</code> - the number of permits to acquire</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="http://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 <code>permits</code> is negative</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="release-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>release</h4> |
| <pre>void release(int permits)</pre> |
| <div class="block">Releases the given number of permits, returning them to the semaphore. |
| |
| <p>Releases the given number of permits, increasing the number of available permits by that amount. If any |
| threads are trying to acquire permits, then one is selected and given the permits that were just released. If the |
| number of available permits satisfies that thread's request then that thread is (re)enabled for thread scheduling |
| purposes; otherwise the thread will wait until sufficient permits are available. If there are still permits |
| available after this thread's request has been satisfied, then those permits are assigned in turn to other |
| threads trying to acquire permits. |
| |
| <p>There is no requirement that a thread that releases a permit must have acquired that permit by calling <a href="../../../org/apache/ignite/IgniteSemaphore.html#acquire--"><code>acquire</code></a>. Correct usage of a semaphore is established by programming convention in the |
| application.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>permits</code> - the number of permits to release</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="http://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 <code>permits</code> is negative</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 semaphore 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 semaphore has failoverSafe set true</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hasQueuedThreads--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hasQueuedThreads</h4> |
| <pre>boolean hasQueuedThreads()</pre> |
| <div class="block">Queries whether any threads are waiting to acquire. 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 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 waiting to acquire the lock</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getQueueLength--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getQueueLength</h4> |
| <pre>int getQueueLength()</pre> |
| <div class="block">Returns an estimate of the number of nodes waiting to acquire. The value is only an estimate because the number |
| of nodes that are waiting may change dynamically while this method traverses internal data structures. 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>the estimated number of nodes waiting for this lock</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isBroken--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isBroken</h4> |
| <pre>boolean isBroken()</pre> |
| <div class="block">Gets <code>broken</code> status of the semaphore.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>True</code> if a node failed on this semaphore and failoverSafe flag was set to false, <code>false</code> otherwise.</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 <code>removed</code> status of the semaphore.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>True</code> if semaphore was removed from cache, <code>false</code> otherwise.</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 this semaphore.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="http://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="http://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="http://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="http://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/IgniteSemaphore.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 class="aboutLanguage">Ignite - In-Memory Data Fabric</div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../org/apache/ignite/IgniteScheduler.html" title="interface in org.apache.ignite"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../org/apache/ignite/IgniteServices.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/IgniteSemaphore.html" target="_top">Frames</a></li> |
| <li><a href="IgniteSemaphore.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>2018 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 Fabric</b> </td> <td>: ver. <strong>2.6.0</strong> </td> </tr> <tr style="padding: 0; margin: 0"> <td> <b>Release Date</b> </td> <td>: July 10 2018 </td> </tr> </tbody> </table> </td> </tr> </table></small></p> |
| </body> |
| </html> |