broker/test/MessageCollector: code formatter used
This commit is contained in:
@@ -13,12 +13,12 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.server;
|
package io.moquette.server;
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
|
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,6 +27,7 @@ import java.util.concurrent.*;
|
|||||||
public class MessageCollector implements MqttCallback {
|
public class MessageCollector implements MqttCallback {
|
||||||
|
|
||||||
private class ReceivedMessage {
|
private class ReceivedMessage {
|
||||||
|
|
||||||
private final MqttMessage message;
|
private final MqttMessage message;
|
||||||
private final String topic;
|
private final String topic;
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ public class MessageCollector implements MqttCallback {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the message from the queue if not empty, else return null with wait period.
|
* Return the message from the queue if not empty, else return null with wait period.
|
||||||
* */
|
*/
|
||||||
public MqttMessage getMessageImmediate() {
|
public MqttMessage getMessageImmediate() {
|
||||||
if (m_messages.isEmpty()) {
|
if (m_messages.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -94,13 +95,13 @@ public class MessageCollector implements MqttCallback {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when the message sent to a server is ACKED (PUBACK or PUBCOMP by the server)
|
* Invoked when the message sent to a server is ACKED (PUBACK or PUBCOMP by the server)
|
||||||
* */
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||||
// try {
|
// try {
|
||||||
// m_messages.offer(new ReceivedMessage(token.waitMessage(), token.getTopics()[0]));
|
// m_messages.offer(new ReceivedMessage(token.waitMessage(), token.getTopics()[0]));
|
||||||
// } catch (MqttException e) {
|
// } catch (MqttException e) {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user