Package net.tomp2p.futures

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


    private void firstPeer(final Number160 messageKey, final Map<Number640, Data> dataMap, final int hopCounter,
            final boolean isUDP) {
        final List<PeerAddress> list = peer.peerBean().peerMap().all();
        for (final PeerAddress peerAddress : list) {
            FutureChannelCreator frr = peer.connectionBean().reservation().create(isUDP?1:0, isUDP?0:1);
                    frr.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
                        @Override
                        public void operationComplete(final FutureChannelCreator future) throws Exception {
                            if (future.isSuccess()) {
                                BroadcastBuilder broadcastBuilder = new BroadcastBuilder(peer, messageKey);
                                broadcastBuilder.dataMap(dataMap);
View Full Code Here


        LOG.debug("other");
        final List<PeerAddress> list = peer.peerBean().peerMap().all();
        final int max = Math.min(NR, list.size());
        FutureChannelCreator frr = peer.connectionBean().reservation()
                .create(isUDP ? max : 0, isUDP ? 0 : max);
        frr.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
            @Override
            public void operationComplete(final FutureChannelCreator future) throws Exception {
                if (future.isSuccess()) {
                  FutureResponse[] futures = new FutureResponse[max];
                    for (int i = 0; i < max; i++) {
View Full Code Here

     *         connection could not be reserved, maybe due to a shutdown, null is returned.
     */
    public FuturePeerConnection createPeerConnection(final PeerAddress destination, final int heartBeatMillis) {
        final FuturePeerConnection futureDone = new FuturePeerConnection(destination);
        final FutureChannelCreator fcc = connectionBean().reservation().createPermanent(1);
        fcc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
            @Override
            public void operationComplete(final FutureChannelCreator future) throws Exception {
                if (future.isSuccess()) {
                    final ChannelCreator cc = fcc.channelCreator();
                    final PeerConnection peerConnection = new PeerConnection(destination, cc, heartBeatMillis);
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.