Commit e5f339b8 authored by afreyssin's avatar afreyssin
Browse files

Bug fixes: removes old context from disk after cleaning (JORAM-243).

parent 46c60cf8
...@@ -988,6 +988,8 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent ...@@ -988,6 +988,8 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent
Transaction tx = AgentServer.getTransaction(); Transaction tx = AgentServer.getTransaction();
String[] persistedClientNames = tx.getList(ClientContext.getTransactionPrefix(getId())); String[] persistedClientNames = tx.getList(ClientContext.getTransactionPrefix(getId()));
for (int i = 0; i < persistedClientNames.length; i++) { for (int i = 0; i < persistedClientNames.length; i++) {
logger.log(BasicLevel.INFO, "ClientContext named [" + persistedClientNames[i] + "] loaded");
try { try {
ClientContext cc = (ClientContext) tx.load(persistedClientNames[i]); ClientContext cc = (ClientContext) tx.load(persistedClientNames[i]);
cc.txName = persistedClientNames[i]; cc.txName = persistedClientNames[i];
...@@ -1075,6 +1077,10 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent ...@@ -1075,6 +1077,10 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent
if (logger.isLoggable(BasicLevel.DEBUG)) if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Deletes temporary destination " + destId.toString()); logger.log(BasicLevel.DEBUG, "Deletes temporary destination " + destId.toString());
} }
// destroy the context
logger.log(BasicLevel.INFO, "ClientContext named [" + activeCtx.txName + "] deleted");
activeCtx.delete();
} }
// Retrieving the subscriptions' messages. // Retrieving the subscriptions' messages.
...@@ -1099,6 +1105,7 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent ...@@ -1099,6 +1105,7 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent
topics.add(destId); topics.add(destId);
// Deleting the non durable subscriptions. // Deleting the non durable subscriptions.
if (!cSub.getDurable()) { if (!cSub.getDurable()) {
// TODO (AF): Normally the non durable subscription are not saved (see ClientSubscription).
subs.remove(); subs.remove();
try { try {
MXWrapper.unregisterMBean(getSubMBeanName((String) subEntry.getKey())); MXWrapper.unregisterMBean(getSubMBeanName((String) subEntry.getKey()));
...@@ -1106,6 +1113,7 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent ...@@ -1106,6 +1113,7 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent
if (logger.isLoggable(BasicLevel.DEBUG)) if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, " - Problem when unregistering ClientSubscriptionMbean", e1); logger.log(BasicLevel.DEBUG, " - Problem when unregistering ClientSubscriptionMbean", e1);
} }
// TODO (AF): we should remove it using cSub.delete() but it is useless as it is impossible.
} }
// Reinitializing the durable ones. // Reinitializing the durable ones.
else { else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment