Examples of FutureCallback


Examples of com.droidkit.actors.concurrency.FutureCallback

                    try {
                        Future future = (Future) req.getMethod().invoke(this, req.getArgs());
                        if (future instanceof ResultFuture) {
                            req.getFuture().doComplete(future.get());
                        } else if (future instanceof TypedFuture) {
                            future.addListener(new FutureCallback() {
                                @Override
                                public void onResult(Object result) {
                                    req.getFuture().doComplete(result);
                                }
View Full Code Here

Examples of com.google.common.util.concurrent.FutureCallback

            } else {
                Frame caller = stack.peek();
                LOGGER.log(Level.FINE, "finishing subroutine from {0} on {1}", new Object[] {caller, thread});
                State s = getStateMap().get(caller.state);
                assert s instanceof BlockState : "found " + s + " rather than a BlockState on the stack for " + caller.state;
                FutureCallback callback = caller.callback;
                assert callback != null : "no callback defined for " + caller.state;
                caller.callback = null;
                callback.onSuccess(null); // TODO should there be a way of passing a return value from the block?
                heads.put(thread, caller.id);
                try {
                    addingHead(new BlockEndNode<BlockStartNode>(this, newID(), /*TODO*/null, /* TODO is this right? or should it be from caller.id? */prior) {
                        @Override protected String getTypeDisplayName() {
                            return "Block end";
View Full Code Here

Examples of org.axonframework.commandhandling.callbacks.FutureCallback

    @RemotingInclude
    @Override
    public Object sendCommand(Object command) {
        logger.debug("Received a command of type : {}", command.getClass().getSimpleName());
        FutureCallback callback = new FutureCallback();
        commandBus.dispatch(new GenericCommandMessage<Object>(command), callback);
        try {
            return callback.get();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of org.axonframework.commandhandling.callbacks.FutureCallback

        waitForConnectorSync();

        FutureCallback<Object> callback1 = new FutureCallback<Object>();
        connector1.send("1", new GenericCommandMessage<Object>("Hello"), callback1);
        FutureCallback<?> callback2 = new FutureCallback();
        connector1.send("1", new GenericCommandMessage<Object>(1L), callback2);

        FutureCallback<Object> callback3 = new FutureCallback<Object>();
        connector2.send("1", new GenericCommandMessage<String>("Hello"), callback3);
        FutureCallback<?> callback4 = new FutureCallback();
        connector2.send("1", new GenericCommandMessage<Long>(1L), callback4);

        assertEquals("The Reply!", callback1.get());
        assertEquals("The Reply!", callback2.get());
        assertEquals("The Reply!", callback3.get());
        assertEquals("The Reply!", callback4.get());

        assertTrue(connector1.getConsistentHash().equals(connector2.getConsistentHash()));
    }
View Full Code Here

Examples of org.eclipse.jetty.util.FutureCallback

     */
    @Override
    public Future<Void> shutdown()
    {
        _availability = isRunning() ? Availability.SHUTDOWN : Availability.UNAVAILABLE;
        return new FutureCallback(true);
    }
View Full Code Here

Examples of org.eclipse.jetty.util.FutureCallback

    }

    @Override
    public Future<Void> shutdown()
    {
        return new FutureCallback(true);
    }
View Full Code Here

Examples of org.eclipse.jetty.util.FutureCallback

    }

    @Override
    public void reply(ReplyInfo replyInfo) throws InterruptedException, ExecutionException, TimeoutException
    {
        FutureCallback result = new FutureCallback();
        reply(replyInfo, result);
        if (replyInfo.getTimeout() > 0)
            result.get(replyInfo.getTimeout(), replyInfo.getUnit());
        else
            result.get();
    }
View Full Code Here

Examples of org.eclipse.jetty.util.FutureCallback

    }

    @Override
    public void data(DataInfo dataInfo) throws InterruptedException, ExecutionException, TimeoutException
    {
        FutureCallback result = new FutureCallback();
        data(dataInfo, result);
        if (dataInfo.getTimeout() > 0)
            result.get(dataInfo.getTimeout(), dataInfo.getUnit());
        else
            result.get();
    }
View Full Code Here

Examples of org.eclipse.jetty.util.FutureCallback

    }

    @Override
    public void headers(HeadersInfo headersInfo) throws InterruptedException, ExecutionException, TimeoutException
    {
        FutureCallback result = new FutureCallback();
        headers(headersInfo, result);
        if (headersInfo.getTimeout() > 0)
            result.get(headersInfo.getTimeout(), headersInfo.getUnit());
        else
            result.get();
    }
View Full Code Here

Examples of org.eclipse.jetty.util.FutureCallback

                        progress = true;

                    // If the tests wants to block, then block
                    while (_blockAt > 0 && _endp.isOpen() && _in.remaining() < _blockAt)
                    {
                        FutureCallback blockingRead = new FutureCallback();
                        fillInterested(blockingRead);
                        blockingRead.get();
                        filled = _endp.fill(_in);
                        progress |= filled > 0;
                    }

                    // Copy to the out buffer
                    if (BufferUtil.hasContent(_in) && BufferUtil.append(_out, _in) > 0)
                        progress = true;

                    // Blocking writes
                    if (BufferUtil.hasContent(_out))
                    {
                        ByteBuffer out = _out.duplicate();
                        BufferUtil.clear(_out);
                        for (int i = 0; i < _writeCount; i++)
                        {
                            FutureCallback blockingWrite = new FutureCallback();
                            _endp.write(blockingWrite, out.asReadOnlyBuffer());
                            blockingWrite.get();
                        }
                        progress = true;
                    }

                    // are we done?
                    if (_endp.isInputShutdown())
                        _endp.shutdownOutput();
                }
            }
            catch (ExecutionException e)
            {
                // Timeout does not close, so echo exception then shutdown
                try
                {
                    FutureCallback blockingWrite = new FutureCallback();
                    _endp.write(blockingWrite, BufferUtil.toBuffer("EE: " + BufferUtil.toString(_in)));
                    blockingWrite.get();
                    _endp.shutdownOutput();
                }
                catch (Exception e2)
                {
                    // e2.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.