Search in sources :

Example 1 with Message

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));
}
Also used : VoltMessage(org.voltcore.messaging.VoltMessage) Message(org.voltcore.agreement.FakeMesh.Message)

Example 2 with 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);
            }
        }
    }
}
Also used : VoltMessage(org.voltcore.messaging.VoltMessage) FaultMessage(org.voltcore.messaging.FaultMessage) SiteFailureForwardMessage(org.voltcore.messaging.SiteFailureForwardMessage) FaultMessage(org.voltcore.messaging.FaultMessage) VoltMessage(org.voltcore.messaging.VoltMessage) SiteFailureMessage(org.voltcore.messaging.SiteFailureMessage) Message(org.voltcore.agreement.FakeMesh.Message) SiteFailureForwardMessage(org.voltcore.messaging.SiteFailureForwardMessage) SiteFailureMessage(org.voltcore.messaging.SiteFailureMessage)

Aggregations

Message (org.voltcore.agreement.FakeMesh.Message)2 VoltMessage (org.voltcore.messaging.VoltMessage)2 FaultMessage (org.voltcore.messaging.FaultMessage)1 SiteFailureForwardMessage (org.voltcore.messaging.SiteFailureForwardMessage)1 SiteFailureMessage (org.voltcore.messaging.SiteFailureMessage)1