Condensed the looping on subscription on separate class

This commit is contained in:
andsel
2016-12-13 23:43:02 +01:00
parent b58cd086ea
commit 2b554ca475
8 changed files with 96 additions and 208 deletions
@@ -30,12 +30,12 @@ class Qos2PublishHandler {
private final ConcurrentMap<String, ConnectionDescriptor> connectionDescriptors;
private final ISessionsStore m_sessionsStore;
private final String brokerPort;
private final Qos2Publisher qos2Publisher;
private final MetaPublisher metaPublisher;
public Qos2PublishHandler(IAuthorizator authorizator, SubscriptionsStore subscriptions,
IMessagesStore messagesStore, BrokerInterceptor interceptor, ConcurrentMap<String,
ConnectionDescriptor> connectionDescriptors, ISessionsStore sessionsStore, String brokerPort,
Qos2Publisher qos2Publisher) {
ConnectionDescriptor> connectionDescriptors, ISessionsStore sessionsStore, String brokerPort/*,
Qos2Publisher qos2Publisher*/) {
this.m_authorizator = authorizator;
this.subscriptions = subscriptions;
this.m_messagesStore = messagesStore;
@@ -43,7 +43,7 @@ class Qos2PublishHandler {
this.connectionDescriptors = connectionDescriptors;
this.m_sessionsStore = sessionsStore;
this.brokerPort = brokerPort;
this.qos2Publisher = qos2Publisher;
this.metaPublisher = new MetaPublisher(connectionDescriptors, sessionsStore, messagesStore);
}
void receivedPublishQos2(Channel channel, PublishMessage msg) {
@@ -95,7 +95,7 @@ class Qos2PublishHandler {
LOG.trace("content <{}>", DebugUtils.payload2Str(evt.getMessage()));
LOG.trace("subscription tree {}", subscriptions.dumpTree());
}
this.qos2Publisher.publish2Subscribers(evt, topicMatchingSubscriptions);
this.metaPublisher.publish2Subscribers(evt, topicMatchingSubscriptions);
if (evt.isRetained()) {
if (!evt.getMessage().hasRemaining()) {