Changed the way a Client session is active and moved to event and states of Channel for CONNECT and DISCONNET messages
This commit is contained in:
@@ -61,8 +61,6 @@ public class ClientSession {
|
||||
|
||||
private volatile boolean cleanSession;
|
||||
|
||||
private boolean active = false;
|
||||
|
||||
private BlockingQueue<AbstractMessage> m_queueToPublish = new ArrayBlockingQueue<>(Constants.MAX_MESSAGE_QUEUE);
|
||||
|
||||
public ClientSession(String clientID, IMessagesStore messagesStore, ISessionsStore sessionsStore,
|
||||
@@ -133,16 +131,16 @@ public class ClientSession {
|
||||
cleanSession();
|
||||
}
|
||||
|
||||
//deactivate the session
|
||||
deactivate();
|
||||
}
|
||||
|
||||
public void cleanSession() {
|
||||
LOG.info("cleaning old saved subscriptions for client <{}>", this.clientID);
|
||||
m_sessionsStore.wipeSubscriptions(this.clientID);
|
||||
LOG.debug("Wiped subscriptions for client <{}>", this.clientID);
|
||||
|
||||
//remove also the messages stored of type QoS1/2
|
||||
messagesStore.dropMessagesInSession(this.clientID);
|
||||
LOG.debug("Removed messages in session for client <{}>", this.clientID);
|
||||
}
|
||||
|
||||
public boolean isCleanSession() {
|
||||
@@ -154,18 +152,6 @@ public class ClientSession {
|
||||
this.m_sessionsStore.updateCleanStatus(this.clientID, cleanSession);
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
this.active = true;
|
||||
}
|
||||
|
||||
public void deactivate() {
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return this.active;
|
||||
}
|
||||
|
||||
public int nextPacketId() {
|
||||
return this.m_sessionsStore.nextPacketID(this.clientID);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user