ProtocolLib/Javadoc/com/comphenix/protocol/concurrency/BlockingHashMap.html
Kristian S. Stangeland e8f5bce3d5 Update JavaDoc for 2.3.0
2013-03-05 17:07:09 +01:00

454 lines
21 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_13) on Tue Mar 05 17:05:45 CET 2013 -->
<title>BlockingHashMap</title>
<meta name="date" content="2013-03-05">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BlockingHashMap";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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/BlockingHashMap.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-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/comphenix/protocol/concurrency/AbstractIntervalTree.State.html" title="enum in com.comphenix.protocol.concurrency"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../com/comphenix/protocol/concurrency/IntegerSet.html" title="class in com.comphenix.protocol.concurrency"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/comphenix/protocol/concurrency/BlockingHashMap.html" target="_top">Frames</a></li>
<li><a href="BlockingHashMap.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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</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">com.comphenix.protocol.concurrency</div>
<h2 title="Class BlockingHashMap" class="title">Class BlockingHashMap&lt;TKey,TValue&gt;</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.comphenix.protocol.concurrency.BlockingHashMap&lt;TKey,TValue&gt;</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>TKey</code> - - type of the key.</dd><dd><code>TValue</code> - - type of the value.</dd></dl>
<hr>
<br>
<pre>public class <span class="strong">BlockingHashMap&lt;TKey,TValue&gt;</span>
extends java.lang.Object</pre>
<div class="block">A map that supports blocking on read operations. Null keys are not supported.
<p>
Values are stored as weak references, and will be automatically removed once they've all been dereferenced.
<p></div>
<dl><dt><span class="strong">Author:</span></dt>
<dd>Kristian</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#BlockingHashMap()">BlockingHashMap</a></strong>()</code>
<div class="block">Initialize a new map.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;TKey,TValue&gt;&nbsp;<br><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="class in com.comphenix.protocol.concurrency">BlockingHashMap</a>&lt;TKey,TValue&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#create()">create</a></strong>()</code>
<div class="block">Initialize a new map.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#get(TKey)">get</a></strong>(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key)</code>
<div class="block">Waits until a value has been associated with the given key, and then retrieves that value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#get(TKey, long, java.util.concurrent.TimeUnit)">get</a></strong>(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key,
long&nbsp;timeout,
java.util.concurrent.TimeUnit&nbsp;unit)</code>
<div class="block">Waits until a value has been associated with the given key, and then retrieves that value.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#get(TKey, long, java.util.concurrent.TimeUnit, boolean)">get</a></strong>(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key,
long&nbsp;timeout,
java.util.concurrent.TimeUnit&nbsp;unit,
boolean&nbsp;ignoreInterrupted)</code>
<div class="block">Waits until a value has been associated with the given key, and then retrieves that value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.util.Set&lt;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#keys()">keys</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;TKey,TValue&gt;&nbsp;<br>com.google.common.cache.CacheLoader&lt;TKey,TValue&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#newInvalidCacheLoader()">newInvalidCacheLoader</a></strong>()</code>
<div class="block">Retrieve a cache loader that will always throw an exception.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#put(TKey, TValue)">put</a></strong>(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key,
<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&nbsp;value)</code>
<div class="block">Associate a given key with the given value.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#putIfAbsent(TKey, TValue)">putIfAbsent</a></strong>(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key,
<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&nbsp;value)</code>
<div class="block">If and only if a key is not present in the map will it be associated with the given value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#size()">size</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.util.Collection&lt;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html#values()">values</a></strong>()</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="BlockingHashMap()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>BlockingHashMap</h4>
<pre>public&nbsp;BlockingHashMap()</pre>
<div class="block">Initialize a new map.</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="newInvalidCacheLoader()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>newInvalidCacheLoader</h4>
<pre>public static&nbsp;&lt;TKey,TValue&gt;&nbsp;com.google.common.cache.CacheLoader&lt;TKey,TValue&gt;&nbsp;newInvalidCacheLoader()</pre>
<div class="block">Retrieve a cache loader that will always throw an exception.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>An invalid cache loader.</dd></dl>
</li>
</ul>
<a name="create()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>create</h4>
<pre>public static&nbsp;&lt;TKey,TValue&gt;&nbsp;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="class in com.comphenix.protocol.concurrency">BlockingHashMap</a>&lt;TKey,TValue&gt;&nbsp;create()</pre>
<div class="block">Initialize a new map.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>The created map.</dd></dl>
</li>
</ul>
<a name="get(java.lang.Object)">
<!-- -->
</a><a name="get(TKey)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public&nbsp;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&nbsp;get(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key)
throws java.lang.InterruptedException</pre>
<div class="block">Waits until a value has been associated with the given key, and then retrieves that value.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - - the key whose associated value is to be returned</dd>
<dt><span class="strong">Returns:</span></dt><dd>The value to which the specified key is mapped.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.InterruptedException</code> - If the current thread got interrupted while waiting.</dd></dl>
</li>
</ul>
<a name="get(java.lang.Object,long,java.util.concurrent.TimeUnit)">
<!-- -->
</a><a name="get(TKey, long, java.util.concurrent.TimeUnit)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public&nbsp;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&nbsp;get(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key,
long&nbsp;timeout,
java.util.concurrent.TimeUnit&nbsp;unit)
throws java.lang.InterruptedException</pre>
<div class="block">Waits until a value has been associated with the given key, and then retrieves that value.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - - the key whose associated value is to be returned</dd><dd><code>timeout</code> - - the amount of time to wait until an association has been made.</dd><dd><code>unit</code> - - unit of timeout.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The value to which the specified key is mapped, or NULL if the timeout elapsed.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.InterruptedException</code> - If the current thread got interrupted while waiting.</dd></dl>
</li>
</ul>
<a name="get(java.lang.Object,long,java.util.concurrent.TimeUnit,boolean)">
<!-- -->
</a><a name="get(TKey, long, java.util.concurrent.TimeUnit, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public&nbsp;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&nbsp;get(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key,
long&nbsp;timeout,
java.util.concurrent.TimeUnit&nbsp;unit,
boolean&nbsp;ignoreInterrupted)
throws java.lang.InterruptedException</pre>
<div class="block">Waits until a value has been associated with the given key, and then retrieves that value.
<p>
If timeout is zero, this method will return immediately if it can't find an socket injector.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - - the key whose associated value is to be returned</dd><dd><code>timeout</code> - - the amount of time to wait until an association has been made.</dd><dd><code>unit</code> - - unit of timeout.</dd><dd><code>ignoreInterrupted</code> - - TRUE if we should ignore the thread being interrupted, FALSE otherwise.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The value to which the specified key is mapped, or NULL if the timeout elapsed.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.InterruptedException</code> - If the current thread got interrupted while waiting.</dd></dl>
</li>
</ul>
<a name="put(java.lang.Object,java.lang.Object)">
<!-- -->
</a><a name="put(TKey, TValue)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>put</h4>
<pre>public&nbsp;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&nbsp;put(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key,
<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&nbsp;value)</pre>
<div class="block">Associate a given key with the given value.
<p>
Wakes up any blocking getters on this specific key.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - - the key to associate.</dd><dd><code>value</code> - - the value.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The previously associated value.</dd></dl>
</li>
</ul>
<a name="putIfAbsent(java.lang.Object,java.lang.Object)">
<!-- -->
</a><a name="putIfAbsent(TKey, TValue)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putIfAbsent</h4>
<pre>public&nbsp;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&nbsp;putIfAbsent(<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&nbsp;key,
<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&nbsp;value)</pre>
<div class="block">If and only if a key is not present in the map will it be associated with the given value.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - - the key to associate.</dd><dd><code>value</code> - - the value to associate.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The previous value this key has been associated with.</dd></dl>
</li>
</ul>
<a name="size()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>size</h4>
<pre>public&nbsp;int&nbsp;size()</pre>
</li>
</ul>
<a name="values()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>values</h4>
<pre>public&nbsp;java.util.Collection&lt;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TValue</a>&gt;&nbsp;values()</pre>
</li>
</ul>
<a name="keys()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>keys</h4>
<pre>public&nbsp;java.util.Set&lt;<a href="../../../../com/comphenix/protocol/concurrency/BlockingHashMap.html" title="type parameter in BlockingHashMap">TKey</a>&gt;&nbsp;keys()</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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/BlockingHashMap.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-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/comphenix/protocol/concurrency/AbstractIntervalTree.State.html" title="enum in com.comphenix.protocol.concurrency"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../com/comphenix/protocol/concurrency/IntegerSet.html" title="class in com.comphenix.protocol.concurrency"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/comphenix/protocol/concurrency/BlockingHashMap.html" target="_top">Frames</a></li>
<li><a href="BlockingHashMap.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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>