Package net.tomp2p.futures

Examples of net.tomp2p.futures.FutureChannelCreator


      PutBuilder putBuilder = new PutBuilder(master, lKey);
      putBuilder.domainKey(Number160.ZERO);
      putBuilder.dataMapContent(dataMap);
      putBuilder.versionKey(Number160.ZERO);

      FutureChannelCreator fcc = master.peer().connectionBean().reservation().create(0, 1);
      fcc.awaitUninterruptibly();
      cc = fcc.channelCreator();

      // put test data
      FutureResponse fr = master.storeRPC().put(master.peerAddress(), putBuilder, cc);
      fr.awaitUninterruptibly();
      Assert.assertEquals(joins[0][0], replicateI.get());
View Full Code Here


     */
    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

    private void otherPeer(final Number160 messageKey, final Map<Number640, Data> dataMap,
            final int hopCounter, final boolean isUDP) {
        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

     * @return A class that needs to be passed to those methods that should use the already open connection. If the
     *         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);
                    futureDone.done(peerConnection);
                } else {
                    futureDone.failed(future);
                }
View Full Code Here

TOP

Related Classes of net.tomp2p.futures.FutureChannelCreator

Copyright © 2018 www.massapicom. 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.