Examples of FutureTask


Examples of java.util.concurrent.FutureTask

    public void executeWithoutReturn(final String queueId, final Invoker inkover) {
        executeMethodAsScheduledJob(inkover);
    }

    public Future executeAndReturnFuture(final String queueId, final Invoker invoker) {
        FutureTask asyncResult = new FutureTask(executeMethodAsScheduledJob(invoker));
        new Thread(asyncResult).start();
        return asyncResult;
    }
View Full Code Here

Examples of net.tomp2p.futures.FutureTask

     */
    public FutureTask submit(final Number160 locationKey, final Map<Number160, Data> dataMap, final Worker worker,
            final RoutingConfiguration routingConfiguration, final RequestP2PConfiguration requestP2PConfiguration,
            final FutureChannelCreator futureChannelCreator, final boolean signMessage, final boolean isManualCleanup,
            final ConnectionReservation connectionReservation) {
        final FutureTask futureTask = new FutureTask();
        futureChannelCreator.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
            @Override
            public void operationComplete(FutureChannelCreator future) throws Exception {
                if (future.isSuccess()) {
                    final ChannelCreator channelCreator = future.getChannelCreator();
                    // routing, find close peers
                    final FutureRouting futureRouting = createRouting(locationKey, null, null, routingConfiguration,
                            requestP2PConfiguration, Type.REQUEST_4, channelCreator);
                    futureRouting.addListener(new BaseFutureAdapter<FutureRouting>() {
                        @Override
                        public void operationComplete(FutureRouting future) throws Exception {
                            if (futureRouting.isSuccess()) {
                                // direct hits mean that there
                                // is a task scheduled
                                SortedMap<PeerAddress, DigestInfo> map = future.getDirectHitsDigest();
                                // potential hits means that no
                                // task is scheduled
                                NavigableSet<Pair> queue = findBest(map, future.getPotentialHits(), locationKey);
                                parallelRequests(futureTask, queue, requestP2PConfiguration, channelCreator,
                                        locationKey, dataMap, worker, requestP2PConfiguration.isForceUPD(), signMessage);
                            } else {
                                futureTask.setFailed(futureRouting);
                            }
                        }
                    });
                }
                if (!isManualCleanup) {
                    Utils.addReleaseListenerAll(futureTask, connectionReservation, future.getChannelCreator());
                } else {
                    futureTask.setFailed(future);
                }
            }
        });
        return futureTask;
    }
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.