Search in sources :

Example 11 with Mailbox

use of org.voltcore.messaging.Mailbox in project voltdb by VoltDB.

the class MockMailbox method send.

@Override
public void send(long HSId, VoltMessage message) {
    outgoingMessages.add(new Message(HSId, message));
    Mailbox dest = postoffice.get(HSId);
    if (dest != null) {
        message.m_sourceHSId = m_hsId;
        dest.deliver(message);
    }
}
Also used : Mailbox(org.voltcore.messaging.Mailbox)

Example 12 with Mailbox

use of org.voltcore.messaging.Mailbox in project voltdb by VoltDB.

the class ExportDataSource method forwardAckToOtherReplicas.

private void forwardAckToOtherReplicas(long uso) {
    if (m_runEveryWhere && m_replicaRunning) {
        //we dont forward if we are running as replica in replicated export
        return;
    }
    Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get();
    Mailbox mbx = p.getFirst();
    if (mbx != null && p.getSecond().size() > 0) {
        // partition:int(4) + length:int(4) +
        // signaturesBytes.length + ackUSO:long(8) + 2 bytes for runEverywhere or not.
        final int msgLen = 4 + 4 + m_signatureBytes.length + 8 + 2;
        ByteBuffer buf = ByteBuffer.allocate(msgLen);
        buf.putInt(m_partitionId);
        buf.putInt(m_signatureBytes.length);
        buf.put(m_signatureBytes);
        buf.putLong(uso);
        buf.putShort((m_runEveryWhere ? (short) 1 : (short) 0));
        BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[0], buf.array());
        for (Long siteId : p.getSecond()) {
            mbx.send(siteId, bpm);
        }
    }
}
Also used : Mailbox(org.voltcore.messaging.Mailbox) ImmutableList(com.google_voltpatches.common.collect.ImmutableList) ByteBuffer(java.nio.ByteBuffer) BinaryPayloadMessage(org.voltcore.messaging.BinaryPayloadMessage)

Aggregations

Mailbox (org.voltcore.messaging.Mailbox)12 Iv2InitiateTaskMessage (org.voltdb.messaging.Iv2InitiateTaskMessage)8 Test (org.junit.Test)7 StoredProcedureInvocation (org.voltdb.StoredProcedureInvocation)7 SiteProcedureConnection (org.voltdb.SiteProcedureConnection)6 FragmentResponseMessage (org.voltdb.messaging.FragmentResponseMessage)6 ArrayList (java.util.ArrayList)4 List (java.util.List)4 ByteBuffer (java.nio.ByteBuffer)2 EEException (org.voltdb.exceptions.EEException)2 ImmutableList (com.google_voltpatches.common.collect.ImmutableList)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorService (java.util.concurrent.ExecutorService)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1