use of org.voltcore.agreement.FakeMesh.Message in project voltdb by VoltDB.
the class MiniMailbox method send.
@Override
public void send(long hsId, VoltMessage message) {
message.m_sourceHSId = m_HSId;
m_sendQ.offer(new Message(m_HSId, hsId, message));
}
use of org.voltcore.agreement.FakeMesh.Message in project voltdb by VoltDB.
the class MiniNode method run.
@Override
public void run() {
m_miniSite.start();
for (long HSId : m_HSIds) {
// Don't track your own death
if (HSId != m_HSId) {
m_deadTracker.startTracking(HSId);
}
}
m_nodeState.set(NodeState.RUN);
while (m_shouldContinue.get()) {
Message msg = m_recvQ.poll();
synchronized (this) {
if (msg != null) {
if (msg.m_close) {
int failedHostId = CoreUtils.getHostIdFromHSId(msg.m_src);
long agreementHSId = CoreUtils.getHSIdFromHostAndSite(failedHostId, HostMessenger.AGREEMENT_SITE_ID);
m_miniSite.reportFault(agreementHSId);
m_deadTracker.stopTracking(msg.m_src);
} else {
m_deadTracker.updateHSId(msg.m_src);
// inject actual message into mailbox
VoltMessage message = msg.m_msg;
// snoop for SiteFailureMessage, inject into MiniSite's mailbox
if (message instanceof SiteFailureMessage && !(message instanceof SiteFailureForwardMessage)) {
SiteFailureMessage sfm = (SiteFailureMessage) message;
for (FaultMessage fm : sfm.asFaultMessages()) {
m_miniSite.reportFault(fm);
}
}
m_mailbox.deliver(message);
}
}
// Do dead host detection. Need to keep track of receive gaps from the remaining set
// of live hosts.
Set<Long> deadHosts = m_deadTracker.checkTimeouts();
for (long HSId : deadHosts) {
int failedHostId = CoreUtils.getHostIdFromHSId(HSId);
long agreementHSId = CoreUtils.getHSIdFromHostAndSite(failedHostId, HostMessenger.AGREEMENT_SITE_ID);
m_miniSite.reportFault(agreementHSId);
m_deadTracker.stopTracking(HSId);
}
}
}
}
Aggregations