Minor change, minor readability improve

This commit is contained in:
andrea
2013-08-27 16:24:11 +02:00
parent 2cc474dd26
commit 4037a0c0b0
2 changed files with 5 additions and 2 deletions
@@ -408,7 +408,7 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
LOG.debug("processSubscribe invoked"); LOG.debug("processSubscribe invoked");
for (SubscribeMessage.Couple req : msg.subscriptions()) { for (SubscribeMessage.Couple req : msg.subscriptions()) {
QOSType qos = AbstractMessage.QOSType.values()[req.getQos()]; QOSType qos = AbstractMessage.QOSType.fromByte(req.getQos());
Subscription newSubscription = new Subscription(clientID, req.getTopic(), qos, cleanSession); Subscription newSubscription = new Subscription(clientID, req.getTopic(), qos, cleanSession);
subscribeSingleTopic(newSubscription, req.getTopic()); subscribeSingleTopic(newSubscription, req.getTopic());
} }
@@ -423,7 +423,6 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
} }
LOG.info("replying with SubAct to MSG ID " + msg.getMessageID()); LOG.info("replying with SubAct to MSG ID " + msg.getMessageID());
session.write(ackMessage); session.write(ackMessage);
} }
/** /**
@@ -25,6 +25,10 @@ public abstract class AbstractMessage {
public static enum QOSType { public static enum QOSType {
MOST_ONE, LEAST_ONE, EXACTLY_ONCE, RESERVED; MOST_ONE, LEAST_ONE, EXACTLY_ONCE, RESERVED;
public static QOSType fromByte(byte val) {
return AbstractMessage.QOSType.values()[val];
}
} }
//type //type
protected boolean m_dupFlag; protected boolean m_dupFlag;