Commit 1d1b0ea8 authored by David Feliot's avatar David Feliot
Browse files

JORAM-185: bug fixed.

parent 3b1606b5
......@@ -2862,7 +2862,7 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent
long currentTime = System.currentTimeMillis();
// AF: TODO we should parse each message for each subscription
// see ClientSubscription.browseNewMessages
List messages = new ArrayList();
List<Message> messages = new ArrayList<Message>();
for (Iterator msgs = rep.getMessages().iterator(); msgs.hasNext();) {
org.objectweb.joram.shared.messages.Message sharedMsg =
(org.objectweb.joram.shared.messages.Message) msgs.next();
......@@ -2877,9 +2877,7 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent
scheduleDeliveryTimeMessage(from, sharedMsg, delaySubNames);
} else {
// Setting the arrival order of the messages
message.order = arrivalState.getAndIncrementArrivalCount(
message.isPersistent() &&
message.durableAcksCounter > 0);
message.order = arrivalState.getAndIncrementArrivalCount();
messages.add(message);
}
}
......@@ -2901,7 +2899,9 @@ public final class UserAgent extends Agent implements UserAgentMBean, ProxyAgent
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, " -> save message " + message);
// TODO (AF): The message saving does it need the proxy saving ?
if (message.isPersistent()) {
if (message.isPersistent()) {
arrivalState.setModified();
// Persisting the message.
setMsgTxName(message);
message.save();
......
......@@ -61,13 +61,16 @@ public class UserAgentArrivalState implements Encodable, Serializable {
modified = true;
}
long getAndIncrementArrivalCount(boolean persistent) {
if (persistent) {
modified = true;
}
long getAndIncrementArrivalCount() {
return arrivalCount++;
}
public void setModified() {
if (! modified) {
modified = true;
}
}
/**
* Saves this state if modified.
* @throws Exception
......
Supports Markdown
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