本文整理匯總了Java中org.eclipse.paho.client.mqttv3.IMqttActionListener.onFailure方法的典型用法代碼示例。如果您正苦於以下問題:Java IMqttActionListener.onFailure方法的具體用法?Java IMqttActionListener.onFailure怎麽用?Java IMqttActionListener.onFailure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.paho.client.mqttv3.IMqttActionListener
的用法示例。
在下文中一共展示了IMqttActionListener.onFailure方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doConnect
import org.eclipse.paho.client.mqttv3.IMqttActionListener; //導入方法依賴的package包/類
/**
* Actually do the mqtt connect operation
*/
private void doConnect() {
if (clientHandle == null) {
clientHandle = mqttService.getClient(serverURI, clientId,myContext.getApplicationInfo().packageName,
persistence);
}
mqttService.setTraceEnabled(traceEnabled);
mqttService.setTraceCallbackId(clientHandle);
String activityToken = storeToken(connectToken);
try {
mqttService.connect(clientHandle, connectOptions, null,
activityToken);
}
catch (MqttException e) {
IMqttActionListener listener = connectToken.getActionCallback();
if (listener != null) {
listener.onFailure(connectToken, e);
}
}
}
示例2: doConnect
import org.eclipse.paho.client.mqttv3.IMqttActionListener; //導入方法依賴的package包/類
/**
* Actually do the mqtt connect operation
*/
private void doConnect() {
if (clientHandle == null) {
clientHandle = mqttService.getClient(serverURI, clientId,String.valueOf(myContext.hashCode()),
persistence);
}
mqttService.setTraceEnabled(traceEnabled);
mqttService.setTraceCallbackId(clientHandle);
String activityToken = storeToken(connectToken);
try {
mqttService.connect(clientHandle, connectOptions, null,
activityToken);
}
catch (MqttException e) {
IMqttActionListener listener = connectToken.getActionCallback();
if (listener != null) {
listener.onFailure(connectToken, e);
}
}
}
示例3: doConnect
import org.eclipse.paho.client.mqttv3.IMqttActionListener; //導入方法依賴的package包/類
/**
* Actually do the mqtt connect operation
*/
private void doConnect() {
if (clientHandle == null) {
clientHandle = mqttService.getClient(serverURI, clientId,String.valueOf(myContext.hashCode()),
persistence);
}
mqttService.setTraceEnabled(traceEnabled);
mqttService.setTraceCallbackId(clientHandle);
String activityToken = storeToken(connectToken);
try {
mqttService.connect(clientHandle, connectOptions, null,
activityToken);
}
catch (MqttException e) {
IMqttActionListener listener = connectToken.getActionCallback();
if (listener != null) {
listener.onFailure(connectToken, e);
}
}
}
示例4: fireActionEvent
import org.eclipse.paho.client.mqttv3.IMqttActionListener; //導入方法依賴的package包/類
/**
* An action has completed - if a completion listener has been set on the
* token then invoke it with the outcome of the action.
*
* @param token
*/
public void fireActionEvent(MqttToken token) {
final String methodName = "fireActionEvent";
if (token != null) {
IMqttActionListener asyncCB = token.getActionCallback();
if (asyncCB != null) {
if (token.getException() == null) {
// @TRACE 716=call onSuccess key={0}
log.fine(CLASS_NAME, methodName, "716",
new Object[] { token.internalTok.getKey() });
asyncCB.onSuccess(token);
} else {
// @TRACE 717=call onFailure key {0}
log.fine(CLASS_NAME, methodName, "716",
new Object[] { token.internalTok.getKey() });
asyncCB.onFailure(token, token.getException());
}
}
}
}