Examples of IAsyncResult


Examples of org.apache.axis.client.async.IAsyncResult

        call.setUseSOAPAction(true);
        call.setSOAPActionURI("capeconnect:GlobalWeather:StationInfo#listCountries");
        call.setTimeout(new Integer(15 * 1000));
        call.setOperationName(new javax.xml.namespace.QName("capeconnect:GlobalWeather:StationInfo", "listCountries"));
        AsyncCall ac = new AsyncCall(call);
        IAsyncResult result = ac.invoke(new Object[]{});
        System.out.println("STARTED");
        Status status = null;
        while ((status = result.getStatus()) == Status.NONE) {
            System.out.print('.');
            Thread.sleep(50);
        }
        System.out.println("FINISHED");
        if (status == Status.COMPLETED) {
            String[] c = (String[]) result.getResponse();
            System.out.println(c.length);
            for (int i = 0; i < c.length; i++) {
                System.out.println(c[i]);
            }
        } else if (status == Status.EXCEPTION) {
            result.getException().printStackTrace();
        }
    }
View Full Code Here

Examples of org.apache.cassandra.net.IAsyncResult

            eps[i] = endPoints.get(key);
            msgs[i] = messages.get(key);
            ++i;
        }
       
        IAsyncResult iar = MessagingService.getMessagingInstance().sendRR(msgs, eps);
        return iar;
    }
View Full Code Here

Examples of org.apache.cassandra.net.IAsyncResult

        /* Find all the suitable endpoints for the keys */
        Map<String, EndPoint> endPoints = StorageService.instance().findSuitableEndPoints(keys.toArray( new String[0] ));
        /* Construct the messages to be sent out */
        Map<String, Message> messages = constructMessages(readMessages);
        /* Dispatch the messages to the respective endpoints */
        IAsyncResult iar = dispatchMessages(endPoints, messages);       
        List<Object[]> results = iar.multiget(2*DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);
       
        for ( Object[] result : results )
        {
            byte[] body = (byte[])result[0];
            DataInputBuffer bufIn = new DataInputBuffer();
View Full Code Here

Examples of org.apache.cassandra.net.IAsyncResult

        EndPoint endPoint = StorageService.instance().findSuitableEndPoint(command.key);
        assert endPoint != null;
        logger_.debug("weakreadremote reading " + command + " from " + endPoint);
        Message message = command.makeReadMessage();
        message.addHeader(ReadCommand.DO_REPAIR, ReadCommand.DO_REPAIR.getBytes());
        IAsyncResult iar = MessagingService.getMessagingInstance().sendRR(message, endPoint);
        byte[] body;
        try
        {
            Object[] result = iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);
            body = (byte[])result[0];
        }
        catch (TimeoutException e)
        {
            throw new RuntimeException(e);
View Full Code Here

Examples of org.apache.cassandra.net.IAsyncResult

        // notify the remote token
        Message msg = new Message(local, StorageService.Verb.REPLICATION_FINISHED, new byte[0]);
        IFailureDetector failureDetector = FailureDetector.instance;
        while (failureDetector.isAlive(remote))
        {
            IAsyncResult iar = MessagingService.instance().sendRR(msg, remote);
            try
            {
                iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);
                return; // done
            }
            catch(TimeoutException e)
            {
                // try again
View Full Code Here

Examples of org.apache.cassandra.net.IAsyncResult

                    {
                        logger.error("Can't send migration request: node {} is down.", endpoint);
                        return;
                    }

                    IAsyncResult iar = MessagingService.instance().sendRR(message, endpoint);

                    try
                    {
                        byte[] reply = iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);

                        DefsTable.mergeRemoteSchema(reply, message.getVersion());
                        return;
                    }
                    catch(TimeoutException e)
View Full Code Here

Examples of org.apache.cassandra.net.IAsyncResult

        IFailureDetector failureDetector = FailureDetector.instance;
        if (logger_.isDebugEnabled())
            logger_.debug("Notifying " + remote.toString() + " of replication completion\n");
        while (failureDetector.isAlive(remote))
        {
            IAsyncResult iar = MessagingService.instance().sendRR(msg, remote);
            try
            {
                iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);
                return; // done
            }
            catch(TimeoutException e)
            {
                // try again
View Full Code Here

Examples of org.apache.cassandra.net.IAsyncResult

        do
        {
            Message message = command.getMessage();
            if (logger.isDebugEnabled())
                logger.debug("reading " + command + " from " + message.getMessageId() + "@" + endPoint);
            IAsyncResult iar = MessagingService.instance().sendRR(message, endPoint);

            // read response
            byte[] responseBody;
            try
            {
                responseBody = iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);
            }
            catch (TimeoutException e)
            {
                throw new TimedOutException();
            }
View Full Code Here

Examples of org.apache.cassandra.net.IAsyncResult

        }
        if (remoteResults != null)
        {
            for (Map.Entry<ReadCommand, IAsyncResult> entry : remoteResults.entrySet())
            {
                IAsyncResult iar = entry.getValue();
                byte[] body;
                body = iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);
                ByteArrayInputStream bufIn = new ByteArrayInputStream(body);
                ReadResponse response = ReadResponse.serializer().deserialize(new DataInputStream(bufIn));
                assert response.row() != null;
                rows.add(response.row());
                StorageService.instance.doConsistencyCheck(response.row(), entry.getKey(), iar.getFrom());
            }
        }

        return rows;
    }
View Full Code Here

Examples of org.apache.cassandra.net.IAsyncResult

        IFailureDetector failureDetector = FailureDetector.instance;
        if (logger_.isDebugEnabled())
            logger_.debug("Notifying " + remote.toString() + " of replication completion\n");
        while (failureDetector.isAlive(remote))
        {
            IAsyncResult iar = MessagingService.instance().sendRR(msg, remote);
            try
            {
                iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);
                return; // done
            }
            catch(TimeoutException e)
            {
                // try again
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.