Fixed bug #400 a transient session (clean=true) that tried to lookup session from persistent store
This commit is contained in:
@@ -115,4 +115,6 @@ public abstract class ClientSession {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getSimpleName() + "{clientID='" + clientID + "'}";
|
return getClass().getSimpleName() + "{clientID='" + clientID + "'}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void wipeSubscriptions();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,4 +210,9 @@ public class DurableSession extends ClientSession {
|
|||||||
public int getInflightMessagesNo() {
|
public int getInflightMessagesNo() {
|
||||||
return this.sessionsStore.getInflightMessagesNo(clientID);
|
return this.sessionsStore.getInflightMessagesNo(clientID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wipeSubscriptions() {
|
||||||
|
this.subscriptionsStore.wipeSubscriptions(clientID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,4 +182,9 @@ public class TransientSession extends ClientSession {
|
|||||||
public int getInflightMessagesNo() {
|
public int getInflightMessagesNo() {
|
||||||
return this.inboundInflightMap.size();
|
return this.inboundInflightMap.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wipeSubscriptions() {
|
||||||
|
// it's transient, no need to wide subs because wasn't stored
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ public class ProtocolProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConnectionDescriptor descriptor = new ConnectionDescriptor(clientId, channel, cleanSession);
|
ConnectionDescriptor descriptor = new ConnectionDescriptor(clientId, channel, cleanSession);
|
||||||
ConnectionDescriptor existing = this.connectionDescriptors.addConnection(descriptor);
|
final ConnectionDescriptor existing = this.connectionDescriptors.addConnection(descriptor);
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
LOG.info("Client ID is being used in an existing connection, force to be closed. CId={}", clientId);
|
LOG.info("Client ID is being used in an existing connection, force to be closed. CId={}", clientId);
|
||||||
existing.abort();
|
existing.abort();
|
||||||
@@ -616,7 +616,8 @@ public class ProtocolProcessor {
|
|||||||
|
|
||||||
if (descriptor.cleanSession) {
|
if (descriptor.cleanSession) {
|
||||||
LOG.info("Removing saved subscriptions. CId={}", descriptor.clientID);
|
LOG.info("Removing saved subscriptions. CId={}", descriptor.clientID);
|
||||||
subscriptionStore.wipeSubscriptions(clientID);
|
final ClientSession session = this.sessionsRepository.sessionForClient(clientID);
|
||||||
|
session.wipeSubscriptions();
|
||||||
LOG.info("Saved subscriptions have been removed. CId={}", descriptor.clientID);
|
LOG.info("Saved subscriptions have been removed. CId={}", descriptor.clientID);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -110,11 +110,6 @@ public class SessionsRepository {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCleanStatus(String clientID, boolean cleanSession) {
|
|
||||||
LOG.info("Updating cleanSession flag. CId={}, cleanSession={}", clientID, cleanSession);
|
|
||||||
this.sessions.updateCleanStatus(clientID, cleanSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientSession createOrLoadClientSession(String clientId, boolean cleanSession) {
|
ClientSession createOrLoadClientSession(String clientId, boolean cleanSession) {
|
||||||
ClientSession clientSession = this.sessionForClient(clientId);
|
ClientSession clientSession = this.sessionForClient(clientId);
|
||||||
if (clientSession == null) {
|
if (clientSession == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user