Package net.sf.clairv.p2p.util

Examples of net.sf.clairv.p2p.util.Counter


  }

  public void send(String key, Message message) {
    Id id = idFactory.buildId(key);
    log.debug("Sending message with id: " + id.toStringFull());
    final Counter counter = new Counter(1);
    this.endpoint.route(id, message, null, new DeliveryNotification() {

      public void sendFailed(MessageReceipt arg0, Exception arg1) {
        log.warn("Failed to send the message");
        counter.decrement();
      }

      public void sent(MessageReceipt receipt) {
        counter.decrement();
      }

    });
    while (counter.getValue() == 1) {

    }
  }
View Full Code Here


      if (nodeId.equalsIgnoreCase(nh.getId().toStringFull())) {
        log
            .debug("Found a node in leaf set to which the message can be "
                + "sent directly: " + nodeId);
        found = true;
        final Counter counter = new Counter(1);
        endpoint.route(null, message, nh, new DeliveryNotification() {

          public void sendFailed(MessageReceipt arg0, Exception arg1) {
            log.warn("Failed to directly send a message", arg1);
            counter.decrement();
          }

          public void sent(MessageReceipt arg0) {
            counter.decrement();
          }

        });
        while (counter.getValue() == 1) {

        }
        break;
      }
    }
View Full Code Here

TOP

Related Classes of net.sf.clairv.p2p.util.Counter

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.