Package co.paralleluniverse.galaxy.core.Message

Examples of co.paralleluniverse.galaxy.core.Message.LineMessage


            processLines(new LinePredicate() {
                @Override
                public boolean processLine(CacheLine line) {
                    // remove pending messages from node
                    for (Iterator<LineMessage> it = getPendingMessages(line).iterator(); it.hasNext();) {
                        LineMessage message = it.next();
                        if (message.getNode() == node)
                            it.remove();
                    }
                    processLineOnNodeEvent(line, node, newOwner);
                    return true;
                }
View Full Code Here


    }

    private void sendToOwnerOf(long line, Msg msg) throws TimeoutException {
        if (LOG.isDebugEnabled())
            LOG.debug("Sending to owner of {}: {}", Long.toHexString(line), msg);
        final LineMessage message = Message.MSG((short) -1, line, Streamables.toByteArray(msg));
        cache.doOp(Type.SEND, line, null, message, null);
    }
View Full Code Here

    }

    private ListenableFuture<Void> sendToOwnerOfAsync(long line, Msg msg) {
        if (LOG.isDebugEnabled())
            LOG.debug("Sending to owner of {}: {}", Long.toHexString(line), msg);
        final LineMessage message = Message.MSG((short) -1, line, Streamables.toByteArray(msg));
        return (ListenableFuture<Void>) (Object) cache.doOpAsync(Type.SEND, line, null, message, null);
    }
View Full Code Here

    }

    private void sendToOwnerOf(long line, Msg msg) throws TimeoutException {
        if (LOG.isDebugEnabled())
            LOG.debug("Sending to owner of {}: {}", Long.toHexString(line), msg);
        final LineMessage message = Message.MSG((short) -1, line, Streamables.toByteArray(msg));
        cache.doOp(Type.SEND, line, null, message, null);
    }
View Full Code Here

    }

    private ListenableFuture<Void> sendToOwnerOfAsync(long line, Msg msg) {
        if (LOG.isDebugEnabled())
            LOG.debug("Sending to owner of {}: {}", Long.toHexString(line), msg);
        final LineMessage message = Message.MSG((short) -1, line, Streamables.toByteArray(msg));
        return (ListenableFuture<Void>) (Object) cache.doOpAsync(Type.SEND, line, null, message, null);
    }
View Full Code Here

            processLines(new LinePredicate() {
                @Override
                public boolean processLine(CacheLine line) {
                    // remove pending messages from node
                    for (Iterator<LineMessage> it = getPendingMessages(line).iterator(); it.hasNext();) {
                        LineMessage message = it.next();
                        if (message.getNode() == node)
                            it.remove();
                    }
                    processLineOnNodeEvent(line, node, newOwner);
                    return true;
                }
View Full Code Here

     */
    @Test
    public void whenGETAndHasOwnerThenReplyCHNGD_OWNR() throws Exception {
        when(store.casOwner(id(154), sh(0), sh(10))).thenReturn(sh(3));

        final LineMessage get = Message.GET(sh(10), id(154));
        mm.receive(get);

        verify(comm).send(argThat(equalTo(Message.CHNGD_OWNR(get, id(154), sh(3), true))));
        verify(monitor).addOwnerServed();
        verifyNoMoreInteractions(monitor);
View Full Code Here

    @Test
    public void whenGETAndNoOwnerThenFindAllocation() throws Exception {
        when(store.casOwner(id(154), sh(0), sh(10))).thenReturn(sh(-1));
        when(store.findAllocation(id(154))).thenReturn(sh(3));

        final LineMessage get = Message.GET(sh(10), id(154));
        mm.receive(get);

        verify(comm).send(argThat(equalTo(Message.CHNGD_OWNR(get, id(154), sh(3), true))));
    }
View Full Code Here

    @Test
    public void whenGETAndNoOwnerThenReplyNOT_FOUND() throws Exception {
        when(store.casOwner(id(154), sh(0), sh(10))).thenReturn(sh(-1));
        when(store.findAllocation(id(154))).thenReturn(sh(-1));

        final LineMessage get = Message.GET(sh(10), id(154));
        mm.receive(get);

        verify(comm).send(argThat(equalTo(Message.NOT_FOUND(get))));
    }
View Full Code Here

     */
    @Test
    public void whenGETAndServerIsOwnerThenReplyPUTX() throws Exception {
        when(store.casOwner(id(154), sh(0), sh(10))).thenReturn(sh(10));
        when(store.read(id(154))).thenReturn(new MainMemoryEntry(1234, new byte[]{3, 4, 5}));
        final LineMessage get = Message.GET(sh(10), id(154));
        mm.receive(get);

        verify(store).casOwner(id(154), sh(0), sh(10));
        verify(store).read(id(154));
        verify(comm).send(argThat(equalTo(Message.PUTX(get, id(154), new short[0], 0, 1234, ByteBuffer.wrap(new byte[]{3, 4, 5})))));
View Full Code Here

TOP

Related Classes of co.paralleluniverse.galaxy.core.Message.LineMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.