Commit e216871e authored by Andre Freyssinet's avatar Andre Freyssinet
Browse files

Validates consumers after messages reloading (needed by BatchEngine and

batchNetwork consumers, cf. JMQ-184).
parent b0c8efd5
/*
* Copyright (C) 2001 - 2019 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2020 ScalAgent Distributed Technologies
* Copyright (C) 2004 France Telecom R&D
* Copyright (C) 1996 - 2000 BULL
* Copyright (C) 1996 - 2000 INRIA
......@@ -1422,15 +1422,21 @@ public final class AgentServer {
try {
// then restores all messages.
String[] list = transaction.getList("@");
// BatchEngine and BatchNetwork need a global validate operation after insertion.
Vector<MessageConsumer> toValidate = new Vector<MessageConsumer>();
for (int i=0; i<list.length; i++) {
Message msg = Message.load(list[i]);
if (msg.getSource() == serverId) {
// The update has been locally generated, the message is ready to
// deliver to its consumer (Engine or Network component). So we have
// to insert it in the queue of this consumer.
// The update has been locally generated, the message is ready to deliver to its
// consumer (Engine or Network component). So we have to insert it in the queue
// of this consumer.
try {
getServerDesc(msg.getDest()).getDomain().insert(msg);
MessageConsumer cons = getServerDesc(msg.getDest()).getDomain();
cons.insert(msg);
// BatchEngine and BatchNetwork need a global validate operation after insertion.
if (! toValidate.contains(cons))
toValidate.add(cons);
} catch (UnknownServerException exc) {
logmon.log(BasicLevel.ERROR,
getName() + ", discard message to unknown server id#" +
......@@ -1461,6 +1467,9 @@ public final class AgentServer {
continue;
}
}
// BatchEngine and BatchNetwork need a global validate operation after insertion.
for (MessageConsumer cons : toValidate)
cons.validate();
} catch (ClassNotFoundException exc) {
logmon.log(BasicLevel.FATAL,
getName() + ", can't restore messages", exc);
......
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