mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 13:19:02 +00:00
(mq) Rename notify to sendNotice to avoid name clash with the java object function
This commit is contained in:
parent
cdfe284f9a
commit
c2b45bec8d
@ -154,10 +154,10 @@ public class MqOutbox {
|
|||||||
return Optional.ofNullable(response);
|
return Optional.ofNullable(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long notify(String function, String payload) throws Exception {
|
public long sendNotice(String function, String payload) throws Exception {
|
||||||
return persistence.sendNewMessage(inboxName, null, null, function, payload, null);
|
return persistence.sendNewMessage(inboxName, null, null, function, payload, null);
|
||||||
}
|
}
|
||||||
public long notify(long relatedId, String function, String payload) throws Exception {
|
public long sendNotice(long relatedId, String function, String payload) throws Exception {
|
||||||
return persistence.sendNewMessage(inboxName, null, relatedId, function, payload, null);
|
return persistence.sendNewMessage(inboxName, null, relatedId, function, payload, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package nu.marginalia.mqsm;
|
|||||||
import nu.marginalia.mq.MessageQueueFactory;
|
import nu.marginalia.mq.MessageQueueFactory;
|
||||||
import nu.marginalia.mq.MqMessage;
|
import nu.marginalia.mq.MqMessage;
|
||||||
import nu.marginalia.mq.MqMessageState;
|
import nu.marginalia.mq.MqMessageState;
|
||||||
import nu.marginalia.mq.inbox.MqInboxIf;
|
|
||||||
import nu.marginalia.mq.inbox.MqInboxResponse;
|
import nu.marginalia.mq.inbox.MqInboxResponse;
|
||||||
import nu.marginalia.mq.inbox.MqSubscription;
|
import nu.marginalia.mq.inbox.MqSubscription;
|
||||||
import nu.marginalia.mq.inbox.MqSynchronousInbox;
|
import nu.marginalia.mq.inbox.MqSynchronousInbox;
|
||||||
@ -136,7 +135,7 @@ public class StateMachine {
|
|||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
smOutbox.notify(transition.state(), transition.message());
|
smOutbox.sendNotice(transition.state(), transition.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialize the state machine. */
|
/** Initialize the state machine. */
|
||||||
@ -148,7 +147,7 @@ public class StateMachine {
|
|||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
smOutbox.notify(transition.state(), transition.message());
|
smOutbox.sendNotice(transition.state(), transition.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialize the state machine. */
|
/** Initialize the state machine. */
|
||||||
@ -160,7 +159,7 @@ public class StateMachine {
|
|||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
smOutbox.notify(transition.state(), transition.message());
|
smOutbox.sendNotice(transition.state(), transition.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialize the state machine. */
|
/** Initialize the state machine. */
|
||||||
@ -172,7 +171,7 @@ public class StateMachine {
|
|||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
smOutbox.notify(transition.state(), transition.message());
|
smOutbox.sendNotice(transition.state(), transition.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Resume the state machine from the last known state. */
|
/** Resume the state machine from the last known state. */
|
||||||
@ -219,7 +218,7 @@ public class StateMachine {
|
|||||||
try {
|
try {
|
||||||
if (resumeState.resumeBehavior().equals(ResumeBehavior.ERROR)) {
|
if (resumeState.resumeBehavior().equals(ResumeBehavior.ERROR)) {
|
||||||
// The message is acknowledged, but the state does not support resuming
|
// The message is acknowledged, but the state does not support resuming
|
||||||
smOutbox.notify(expectedMessage.id, "ERROR", "Illegal resumption from ACK'ed state " + message.function());
|
smOutbox.sendNotice(expectedMessage.id, "ERROR", "Illegal resumption from ACK'ed state " + message.function());
|
||||||
}
|
}
|
||||||
else if (resumeState.resumeBehavior().equals(ResumeBehavior.RESTART)) {
|
else if (resumeState.resumeBehavior().equals(ResumeBehavior.RESTART)) {
|
||||||
this.state = resumeState;
|
this.state = resumeState;
|
||||||
@ -227,7 +226,7 @@ public class StateMachine {
|
|||||||
// The message is already acknowledged, we flag it as dead and then send an identical message
|
// The message is already acknowledged, we flag it as dead and then send an identical message
|
||||||
smOutbox.flagAsDead(message.msgId());
|
smOutbox.flagAsDead(message.msgId());
|
||||||
expectedMessage = ExpectedMessage.responseTo(message);
|
expectedMessage = ExpectedMessage.responseTo(message);
|
||||||
smOutbox.notify(message.msgId(), "INITIAL", "");
|
smOutbox.sendNotice(message.msgId(), "INITIAL", "");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.state = resumeState;
|
this.state = resumeState;
|
||||||
@ -235,7 +234,7 @@ public class StateMachine {
|
|||||||
// The message is already acknowledged, we flag it as dead and then send an identical message
|
// The message is already acknowledged, we flag it as dead and then send an identical message
|
||||||
smOutbox.flagAsDead(message.msgId());
|
smOutbox.flagAsDead(message.msgId());
|
||||||
expectedMessage = ExpectedMessage.responseTo(message);
|
expectedMessage = ExpectedMessage.responseTo(message);
|
||||||
smOutbox.notify(message.msgId(), message.function(), message.payload());
|
smOutbox.sendNotice(message.msgId(), message.function(), message.payload());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
@ -288,7 +287,7 @@ public class StateMachine {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
expectedMessage = ExpectedMessage.responseTo(msg);
|
expectedMessage = ExpectedMessage.responseTo(msg);
|
||||||
smOutbox.notify(expectedMessage.id, transition.state(), transition.message());
|
smOutbox.sendNotice(expectedMessage.id, transition.state(), transition.message());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -319,7 +318,7 @@ public class StateMachine {
|
|||||||
// and also permits the real termination message to have an
|
// and also permits the real termination message to have an
|
||||||
// unique expected ID
|
// unique expected ID
|
||||||
|
|
||||||
long abortMsgId = smOutbox.notify(expectedMessage.id, "ABORT", "Aborting execution");
|
long abortMsgId = smOutbox.sendNotice(expectedMessage.id, "ABORT", "Aborting execution");
|
||||||
|
|
||||||
// Set it as dead to clean up the queue from mystery ACK messages
|
// Set it as dead to clean up the queue from mystery ACK messages
|
||||||
smOutbox.flagAsDead(abortMsgId);
|
smOutbox.flagAsDead(abortMsgId);
|
||||||
@ -333,7 +332,7 @@ public class StateMachine {
|
|||||||
expectedMessage = ExpectedMessage.expectId(abortMsgId);
|
expectedMessage = ExpectedMessage.expectId(abortMsgId);
|
||||||
|
|
||||||
// Add a state transition to the final state
|
// Add a state transition to the final state
|
||||||
smOutbox.notify(abortMsgId, finalState.name(), "");
|
smOutbox.sendNotice(abortMsgId, finalState.name(), "");
|
||||||
|
|
||||||
// Dislodge the current task with an interrupt.
|
// Dislodge the current task with an interrupt.
|
||||||
// It's actually fine if we accidentally interrupt the wrong thread
|
// It's actually fine if we accidentally interrupt the wrong thread
|
||||||
|
Loading…
Reference in New Issue
Block a user