Package net.tomp2p.futures

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


      c.pipelineFilter(new MyPipeLine());
      Reservation r = new Reservation(workerGroup, c);
      List<FutureChannelCreator> fcc = new ArrayList<FutureChannelCreator>();
      for (int j = 0; j < inner; j++) {
        FutureChannelCreator fc = r.create(0, conn);
        fc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
          @Override
          public void operationComplete(final FutureChannelCreator future) throws Exception {
            final ChannelCreator cc = future.channelCreator();
            final int timeout = 2000;
            final CountDownLatch countDownLatch = new CountDownLatch(conn);
View Full Code Here


      c.maxPermitsUDP(udpMax);
      Reservation r = new Reservation(workerGroup, c);
      List<FutureChannelCreator> fcc = new ArrayList<FutureChannelCreator>();
      for (int j = 0; j < inner; j++) {
        FutureChannelCreator fc = r.create(conn, 0);
        fc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
          @Override
          public void operationComplete(final FutureChannelCreator future) throws Exception {
            final ChannelCreator cc = future.channelCreator();
            final CountDownLatch countDownLatch = new CountDownLatch(conn);
            for (int k = 0; k < conn; k++) {
View Full Code Here

      c.maxPermitsTCP(tcpMax);
      Reservation r = new Reservation(workerGroup, c);
      List<FutureChannelCreator> fcc = new ArrayList<FutureChannelCreator>();
      for (int j = 0; j < inner; j++) {
        FutureChannelCreator fc = r.create(0, conn);
        fc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
          @Override
          public void operationComplete(final FutureChannelCreator future) throws Exception {
            if (future.isFailed()) {
              return;
            }
View Full Code Here

      c.maxPermitsTCP(tcpMax);
      Reservation r = new Reservation(ev, c);
      List<FutureChannelCreator> fcc = new ArrayList<FutureChannelCreator>();
      for (int j = 0; j < inner; j++) {
        FutureChannelCreator fc = r.create(0, conn);
        fc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
          @Override
          public void operationComplete(final FutureChannelCreator future) throws Exception {
            if (future.isFailed()) {
              return;
            }
View Full Code Here

            synchronized (lock) {
                status.put(taskKey, Status.SUCCESS_RESULT_NOT_SENT);
            }
            final Map<Number160, Data> outputData2 = outputData;
            FutureChannelCreator futureChannelCreator = connectionBean.getConnectionReservation().reserve(1);
            futureChannelCreator.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
                @Override
                public void operationComplete(final FutureChannelCreator futureChannelCreator) throws Exception {
                    if (futureChannelCreator.isSuccess()) {
                        FutureResponse futureResponse = getTaskRPC().sendResult(senderAddress,
                                futureChannelCreator.getChannelCreator(), taskId, outputData2,
View Full Code Here

  public FutureDone<Void> peerExchange(final PeerAddress remotePeer, final Number320 key, final TrackerData data,
          final ConnectionConfiguration connectionConfiguration) {
    final FutureDone<Void> futureDone = new FutureDone<Void>();
    FutureChannelCreator futureChannelCreator = peer.connectionBean().reservation().create(1, 0);
    Utils.addReleaseListener(futureChannelCreator, futureDone);
    futureChannelCreator.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
      @Override
      public void operationComplete(FutureChannelCreator future) throws Exception {
        if (future.isSuccess()) {
          final ChannelCreator channelCreator = future.channelCreator();
          FutureResponse futureResponse = peerExchangeRPC.peerExchange(remotePeer, key, channelCreator, data,
View Full Code Here

      FutureChannelCreator futureChannelCreator = sender.peer().connectionBean().reservation().create(0, 1);

      final CountDownLatch latch = new CountDownLatch(1);
      final PeerAddress receiverAddress = receiver.peerAddress();

      futureChannelCreator.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
        @Override
        public void operationComplete(final FutureChannelCreator future2) throws Exception {
          if (future2.isSuccess()) {
            SyncBuilder synchronizationBuilder = new SyncBuilder(senderSync, receiverAddress, 5);
            synchronizationBuilder.dataMap(dataMap);
View Full Code Here

      sender.peer().bootstrap().peerAddress(receiver.peerAddress()).start().awaitUninterruptibly();
      final CountDownLatch latch = new CountDownLatch(1);
      final PeerAddress receiverAddress = receiver.peerAddress();
      FutureChannelCreator futureChannelCreator = sender.peer().connectionBean().reservation().create(0, 1);
      futureChannelCreator.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
        @Override
        public void operationComplete(final FutureChannelCreator future2) throws Exception {
          if (future2.isSuccess()) {
            SyncBuilder synchronizationBuilder = new SyncBuilder(senderSync, receiverAddress, 5);
            synchronizationBuilder.dataMap(dataMap);
View Full Code Here

      final CountDownLatch latch = new CountDownLatch(1);
      final PeerAddress receiverAddress = receiver.peerAddress();

      FutureChannelCreator futureChannelCreator = sender.peer().connectionBean().reservation().create(0, 1);
      futureChannelCreator.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
        @Override
        public void operationComplete(final FutureChannelCreator future2) throws Exception {
          if (future2.isSuccess()) {
            SyncBuilder synchronizationBuilder = new SyncBuilder(senderSync, receiverAddress, 5);
            synchronizationBuilder.dataMap(dataMap);
View Full Code Here

   * overhead of sendDirect.
   */
  private static void send(final PeerConnection peerConnection, PeerBean peerBean, ConnectionBean connectionBean, ConnectionConfiguration config, final FutureResponse futureResponse) {
    final RequestHandler<FutureResponse> requestHandler = new RequestHandler<FutureResponse>(futureResponse, peerBean, connectionBean, config);
    final FutureChannelCreator fcc = peerConnection.acquire(futureResponse);
    fcc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
      @Override
      public void operationComplete(FutureChannelCreator future) throws Exception {
        if (future.isSuccess()) {
          requestHandler.sendTCP(peerConnection.channelCreator(), peerConnection);
        } else {
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.