當前位置: 首頁>>代碼示例>>Java>>正文


Java IMqttActionListener.onFailure方法代碼示例

本文整理匯總了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);
		}
	}
}
 
開發者ID:Cirrus-Link,項目名稱:Sparkplug,代碼行數:24,代碼來源:MqttAndroidClient.java

示例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);
        }
    }
}
 
開發者ID:octoblu,項目名稱:droidblu,代碼行數:24,代碼來源:MqttAndroidClient.java

示例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);
		}
	}
}
 
開發者ID:slimpp,項目名稱:SlimChat.Android,代碼行數:24,代碼來源:MqttAndroidClient.java

示例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());
			}
		}
	}
}
 
開發者ID:gulliverrr,項目名稱:hestia-engine-dev,代碼行數:27,代碼來源:CommsCallback.java


注:本文中的org.eclipse.paho.client.mqttv3.IMqttActionListener.onFailure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。