Package net.tomp2p.futures

Examples of net.tomp2p.futures.FutureRouting.addListener()


                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
View Full Code Here


                if (future.isSuccess()) {
                  final RoutingBuilder routingBuilder = createBuilder(builder);
                  final FutureRouting futureRouting = routing.route(routingBuilder, Type.REQUEST_1, future.channelCreator());
                 
                    futureDHT.futureRouting(futureRouting);
                    futureRouting.addListener(new BaseFutureAdapter<FutureRouting>() {
                        @Override
                        public void operationComplete(final FutureRouting futureRouting) throws Exception {
                            if (futureRouting.isSuccess()) {
                                logger.debug("adding lkey={} on {}", builder.locationKey(),
                                        futureRouting.potentialHits());
View Full Code Here

                 
                  final RoutingBuilder routingBuilder = createBuilder(builder);
                  final FutureRouting futureRouting = routing.route(routingBuilder, Type.REQUEST_1, future.channelCreator());

                    futureDHT.futureRouting(futureRouting);
                    futureRouting.addListener(new BaseFutureAdapter<FutureRouting>() {
                        @Override
                        public void operationComplete(FutureRouting futureRouting) throws Exception {
                            if (futureRouting.isSuccess()) {
                                logger.debug("storing lkey={} on {}", builder.locationKey(),
                                        futureRouting.potentialHits());
View Full Code Here

                 
                  final RoutingBuilder routingBuilder = createBuilder(putBuilder);
                  final FutureRouting futureRouting = routing.route(routingBuilder, Type.REQUEST_1, future.channelCreator());
                 
                    futureDHT.futureRouting(futureRouting);
                    futureRouting.addListener(new BaseFutureAdapter<FutureRouting>() {
                        @Override
                        public void operationComplete(final FutureRouting futureRouting) throws Exception {
                            if (futureRouting.isSuccess()) {
                                logger.debug("storing lkey={} on {}", putBuilder.locationKey(),
                                        futureRouting.potentialHits());
View Full Code Here

                  final RoutingBuilder routingBuilder = createBuilder(builder);
                  fillRoutingBuilder(builder, routingBuilder);
                  final FutureRouting futureRouting = routing.route(routingBuilder, builder.isFastGet()? Type.REQUEST_2 : Type.REQUEST_1, future.channelCreator());

                    futureDHT.futureRouting(futureRouting);
                    futureRouting.addListener(new BaseFutureAdapter<FutureRouting>() {
                        @Override
                        public void operationComplete(FutureRouting futureRouting) throws Exception {
                            if (futureRouting.isSuccess()) {
                                logger.debug("found direct hits for get: {}", futureRouting.directHits());
                                     
View Full Code Here

                  final RoutingBuilder routingBuilder = createBuilder(builder);
                  fillRoutingBuilder(builder, routingBuilder);
                  final FutureRouting futureRouting = routing.route(routingBuilder, builder.isFastGet()? Type.REQUEST_2 : Type.REQUEST_1, future.channelCreator());
                   
                    futureDHT.futureRouting(futureRouting);
                    futureRouting.addListener(new BaseFutureAdapter<FutureRouting>() {
                        @Override
                        public void operationComplete(FutureRouting futureRouting) throws Exception {
                            if (futureRouting.isSuccess()) {
                                logger.debug("found direct hits for digest: {}",
                                        futureRouting.directHits());
View Full Code Here

                  final RoutingBuilder routingBuilder = createBuilder(builder);
                    fillRoutingBuilder(builder, routingBuilder);
                  final FutureRouting futureRouting = routing.route(routingBuilder, builder.isFastGet() ? Type.REQUEST_2 : Type.REQUEST_1, future.channelCreator());

                    futureDHT.futureRouting(futureRouting);
                    futureRouting.addListener(new BaseFutureAdapter<FutureRouting>() {
                        @Override
                        public void operationComplete(FutureRouting futureRouting) throws Exception {
                            if (futureRouting.isSuccess()) {

                                logger.debug("found direct hits for remove: {}",
View Full Code Here

              if (futureChannelCreator.isSuccess()) {
                ChannelCreator cc = futureChannelCreator.channelCreator();
                RoutingBuilder routingBuilder = BootstrapBuilder.createBuilder(routingConfiguration, forceRoutingOnlyToSelf);
                routingBuilder.locationKey(peer.peerID());
                FutureRouting futureRouting = peer.distributedRouting().quit(routingBuilder, cc);
                futureRouting.addListener(new BaseFutureAdapter<FutureRouting>() {
            @Override
                        public void operationComplete(FutureRouting future) throws Exception {
                         if(future.isSuccess()) {
                           futureShutdown.done();
                         } else {
View Full Code Here

        routingBuilder.bootstrap(true);

        final FutureRouting futureRouting0 = routing(peerAddresses, routingBuilder, Type.REQUEST_1, cc);
        // to not become a Fachidiot (expert idiot), we need to know other peers
        // as well. This is important if this peer is passive and only replies on requests from other peers
        futureRouting0.addListener(new BaseFutureAdapter<FutureRouting>() {
            @Override
            public void operationComplete(final FutureRouting future) throws Exception {
                // setting this to null causes to search for a random number
              if(future.isSuccess()) {
                routingBuilder.locationKey(null);
View Full Code Here

            public void operationComplete(final FutureRouting future) throws Exception {
                // setting this to null causes to search for a random number
              if(future.isSuccess()) {
                routingBuilder.locationKey(null);
                final FutureRouting futureRouting1 = routing(peerAddresses, routingBuilder, Type.REQUEST_1, cc);
                futureRouting1.addListener(new BaseFutureAdapter<FutureRouting>() {
                  @Override
                  public void operationComplete(FutureRouting future) throws Exception {
                    final Pair<FutureRouting,FutureRouting> pair = new Pair<FutureRouting, FutureRouting>(futureRouting0, futureRouting1);
                    futureDone.done(pair);
                  }
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.