blob: 84db1e5dca67f0f276cf31acbc0fe54e37809a8a [file] [log] [blame]
<!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 (1.8.0_101) on Thu Sep 01 13:59:13 BST 2016 -->
<title>IMqttToken</title>
<meta name="date" content="2016-09-01">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="IMqttToken";
}
}
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};
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/IMqttToken.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="../../../../../org/eclipse/paho/client/mqttv3/IMqttMessageListener.html" title="interface in org.eclipse.paho.client.mqttv3"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/eclipse/paho/client/mqttv3/MqttAsyncClient.html" title="class in org.eclipse.paho.client.mqttv3"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/eclipse/paho/client/mqttv3/IMqttToken.html" target="_top">Frames</a></li>
<li><a href="IMqttToken.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;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>Constr&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>Constr&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">org.eclipse.paho.client.mqttv3</div>
<h2 title="Interface IMqttToken" class="title">Interface IMqttToken</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttDeliveryToken.html" title="interface in org.eclipse.paho.client.mqttv3">IMqttDeliveryToken</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../org/eclipse/paho/client/mqttv3/MqttDeliveryToken.html" title="class in org.eclipse.paho.client.mqttv3">MqttDeliveryToken</a>, <a href="../../../../../org/eclipse/paho/client/mqttv3/MqttToken.html" title="class in org.eclipse.paho.client.mqttv3">MqttToken</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">IMqttToken</span></pre>
<div class="block">Provides a mechanism for tracking the completion of an asynchronous task.
<p>When using the asynchronous/non-blocking MQTT programming interface all
methods/operations that take any time (and in particular those that involve
any network operation) return control to the caller immediately. The operation
then proceeds to run in the background so as not to block the invoking thread.
An IMqttToken is used to track the state of the operation. An application can use the
token to wait for an operation to complete. A token is passed to callbacks
once the operation completes and provides context linking it to the original
request. A token is associated with a single operation.<p>
<p>
An action is in progress until either:
<ul>
<li>isComplete() returns true or
<li>getException() is not null.
</ul>
</p></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">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</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><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttActionListener.html" title="interface in org.eclipse.paho.client.mqttv3">IMqttActionListener</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#getActionCallback--">getActionCallback</a></span>()</code>
<div class="block">Return the async listener for this token.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttAsyncClient.html" title="interface in org.eclipse.paho.client.mqttv3">IMqttAsyncClient</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#getClient--">getClient</a></span>()</code>
<div class="block">Returns the MQTT client that is responsible for processing the asynchronous
action</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../../../../org/eclipse/paho/client/mqttv3/MqttException.html" title="class in org.eclipse.paho.client.mqttv3">MqttException</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#getException--">getException</a></span>()</code>
<div class="block">Returns an exception providing more detail if an operation failed.</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/eclipse/paho/client/mqttv3/IMqttToken.html#getGrantedQos--">getGrantedQos</a></span>()</code>
<div class="block">Returns the granted QoS list from a suback</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/eclipse/paho/client/mqttv3/IMqttToken.html#getMessageId--">getMessageId</a></span>()</code>
<div class="block">Returns the message ID of the message that is associated with the token.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/eclipse/paho/client/mqttv3/internal/wire/MqttWireMessage.html" title="class in org.eclipse.paho.client.mqttv3.internal.wire">MqttWireMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#getResponse--">getResponse</a></span>()</code>
<div class="block">Returns the response wire message</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/eclipse/paho/client/mqttv3/IMqttToken.html#getSessionPresent--">getSessionPresent</a></span>()</code>
<div class="block">Returns the session present flag from a connack</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>java.lang.String[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#getTopics--">getTopics</a></span>()</code>
<div class="block">Returns the topic string(s) for the action being tracked by this
token.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#getUserContext--">getUserContext</a></span>()</code>
<div class="block">Retrieve the context associated with an action.</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/eclipse/paho/client/mqttv3/IMqttToken.html#isComplete--">isComplete</a></span>()</code>
<div class="block">Returns whether or not the action has finished.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#setActionCallback-org.eclipse.paho.client.mqttv3.IMqttActionListener-">setActionCallback</a></span>(<a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttActionListener.html" title="interface in org.eclipse.paho.client.mqttv3">IMqttActionListener</a>&nbsp;listener)</code>
<div class="block">Register a listener to be notified when an action completes.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#setUserContext-java.lang.Object-">setUserContext</a></span>(java.lang.Object&nbsp;userContext)</code>
<div class="block">Store some context associated with an action.</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/eclipse/paho/client/mqttv3/IMqttToken.html#waitForCompletion--">waitForCompletion</a></span>()</code>
<div class="block">Blocks the current thread until the action this token is associated with has
completed.</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/eclipse/paho/client/mqttv3/IMqttToken.html#waitForCompletion-long-">waitForCompletion</a></span>(long&nbsp;timeout)</code>
<div class="block">Blocks the current thread until the action this token is associated with has
completed.</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="waitForCompletion--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>waitForCompletion</h4>
<pre>void&nbsp;waitForCompletion()
throws <a href="../../../../../org/eclipse/paho/client/mqttv3/MqttException.html" title="class in org.eclipse.paho.client.mqttv3">MqttException</a></pre>
<div class="block">Blocks the current thread until the action this token is associated with has
completed.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../../org/eclipse/paho/client/mqttv3/MqttException.html" title="class in org.eclipse.paho.client.mqttv3">MqttException</a></code> - if there was a problem with the action associated with the token.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#waitForCompletion-long-"><code>waitForCompletion(long)</code></a></dd>
</dl>
</li>
</ul>
<a name="waitForCompletion-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>waitForCompletion</h4>
<pre>void&nbsp;waitForCompletion(long&nbsp;timeout)
throws <a href="../../../../../org/eclipse/paho/client/mqttv3/MqttException.html" title="class in org.eclipse.paho.client.mqttv3">MqttException</a></pre>
<div class="block">Blocks the current thread until the action this token is associated with has
completed.
<p>The timeout specifies the maximum time it will block for. If the action
completes before the timeout then control returns immediately, if not
it will block until the timeout expires. </p>
<p>If the action being tracked fails or the timeout expires an exception will
be thrown. In the event of a timeout the action may complete after timeout.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>timeout</code> - the maximum amount of time to wait for, in milliseconds.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../../org/eclipse/paho/client/mqttv3/MqttException.html" title="class in org.eclipse.paho.client.mqttv3">MqttException</a></code> - if there was a problem with the action associated with the token.</dd>
</dl>
</li>
</ul>
<a name="isComplete--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isComplete</h4>
<pre>boolean&nbsp;isComplete()</pre>
<div class="block">Returns whether or not the action has finished.
<p>True will be returned both in the case where the action finished successfully
and in the case where it failed. If the action failed <a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttToken.html#getException--"><code>getException()</code></a> will
be non null.
</p></div>
</li>
</ul>
<a name="getException--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getException</h4>
<pre><a href="../../../../../org/eclipse/paho/client/mqttv3/MqttException.html" title="class in org.eclipse.paho.client.mqttv3">MqttException</a>&nbsp;getException()</pre>
<div class="block">Returns an exception providing more detail if an operation failed.
<p>While an action in in progress and when an action completes successfully
null will be returned. Certain errors like timeout or shutting down will not
set the exception as the action has not failed or completed at that time
</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>exception may return an exception if the operation failed. Null will be
returned while action is in progress and if action completes successfully.</dd>
</dl>
</li>
</ul>
<a name="setActionCallback-org.eclipse.paho.client.mqttv3.IMqttActionListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setActionCallback</h4>
<pre>void&nbsp;setActionCallback(<a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttActionListener.html" title="interface in org.eclipse.paho.client.mqttv3">IMqttActionListener</a>&nbsp;listener)</pre>
<div class="block">Register a listener to be notified when an action completes.
<p>Once a listener is registered it will be invoked when the action the token
is associated with either succeeds or fails.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listener</code> - to be invoked once the action completes</dd>
</dl>
</li>
</ul>
<a name="getActionCallback--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getActionCallback</h4>
<pre><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttActionListener.html" title="interface in org.eclipse.paho.client.mqttv3">IMqttActionListener</a>&nbsp;getActionCallback()</pre>
<div class="block">Return the async listener for this token.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>listener that is set on the token or null if a listener is not registered.</dd>
</dl>
</li>
</ul>
<a name="getClient--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getClient</h4>
<pre><a href="../../../../../org/eclipse/paho/client/mqttv3/IMqttAsyncClient.html" title="interface in org.eclipse.paho.client.mqttv3">IMqttAsyncClient</a>&nbsp;getClient()</pre>
<div class="block">Returns the MQTT client that is responsible for processing the asynchronous
action</div>
</li>
</ul>
<a name="getTopics--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTopics</h4>
<pre>java.lang.String[]&nbsp;getTopics()</pre>
<div class="block">Returns the topic string(s) for the action being tracked by this
token. If the action has not been initiated or the action has not
topic associated with it such as connect then null will be returned.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the topic string(s) for the subscribe being tracked by this token or null</dd>
</dl>
</li>
</ul>
<a name="setUserContext-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUserContext</h4>
<pre>void&nbsp;setUserContext(java.lang.Object&nbsp;userContext)</pre>
<div class="block">Store some context associated with an action.
<p>Allows the caller of an action to store some context that can be
accessed from within the ActionListener associated with the action. This
can be useful when the same ActionListener is associated with multiple
actions</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>userContext</code> - to associate with an action</dd>
</dl>
</li>
</ul>
<a name="getUserContext--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUserContext</h4>
<pre>java.lang.Object&nbsp;getUserContext()</pre>
<div class="block">Retrieve the context associated with an action.
<p>Allows the ActionListener associated with an action to retrieve any context
that was associated with the action when the action was invoked. If not
context was provided null is returned. </p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Object context associated with an action or null if there is none.</dd>
</dl>
</li>
</ul>
<a name="getMessageId--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMessageId</h4>
<pre>int&nbsp;getMessageId()</pre>
<div class="block">Returns the message ID of the message that is associated with the token.
A message id of zero will be returned for tokens associated with
connect, disconnect and ping operations as there can only ever
be one of these outstanding at a time. For other operations
the MQTT message id flowed over the network.</div>
</li>
</ul>
<a name="getGrantedQos--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getGrantedQos</h4>
<pre>int[]&nbsp;getGrantedQos()</pre>
<div class="block">Returns the granted QoS list from a suback</div>
</li>
</ul>
<a name="getSessionPresent--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSessionPresent</h4>
<pre>boolean&nbsp;getSessionPresent()</pre>
<div class="block">Returns the session present flag from a connack</div>
</li>
</ul>
<a name="getResponse--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getResponse</h4>
<pre><a href="../../../../../org/eclipse/paho/client/mqttv3/internal/wire/MqttWireMessage.html" title="class in org.eclipse.paho.client.mqttv3.internal.wire">MqttWireMessage</a>&nbsp;getResponse()</pre>
<div class="block">Returns the response wire message</div>
</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/IMqttToken.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="../../../../../org/eclipse/paho/client/mqttv3/IMqttMessageListener.html" title="interface in org.eclipse.paho.client.mqttv3"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/eclipse/paho/client/mqttv3/MqttAsyncClient.html" title="class in org.eclipse.paho.client.mqttv3"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/eclipse/paho/client/mqttv3/IMqttToken.html" target="_top">Frames</a></li>
<li><a href="IMqttToken.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;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>Constr&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>Constr&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>