Package org.ardverk.dht.config

Examples of org.ardverk.dht.config.QuickenConfig


    this.configProvider = configProvider;
  }
 
  public DHTFuture<QuickenEntity> quicken(QuickenConfig config) {
   
    QuickenConfig cfg = configProvider.get(config);
   
    TimeStamp creationTime = TimeStamp.now();
   
    List<DHTFuture<PingEntity>> pingFutures = new ArrayList<>();
    List<DHTFuture<NodeEntity>> discoveryFutures = new ArrayList<>();
   
    synchronized (routeTable) {
      int pingCount = (int)(routeTable.getK() * cfg.getPingCount());
     
      Contact localhost = routeTable.getIdentity();
      KUID localhostId = localhost.getId();

      if (0 < pingCount) {
        PingConfig pingConfig = cfg.getPingConfig();
        long contactTimeout = cfg.getContactTimeoutInMillis();
       
        Contact[] contacts = routeTable.select(localhostId, pingCount);
        for (Contact contact : contacts) {
          // Don't send PINGs to the localhost!
          if (contact.equals(localhost)) {
            continue;
          }
         
          if (contact.isTimeout(contactTimeout, TimeUnit.MILLISECONDS)) {
            DHTFuture<PingEntity> future
              = pingManager.ping(contact, pingConfig);
            pingFutures.add(future);
          }
        }
      }
     
      NodeConfig lookupConfig = cfg.getLookupConfig();
      long bucketTimeout = cfg.getBucketTimeoutInMillis();
     
      Bucket[] buckets = routeTable.getBuckets();
      IdentifierUtils.byXor(buckets, localhostId);
     
      for (Bucket bucket : buckets) {
View Full Code Here

TOP

Related Classes of org.ardverk.dht.config.QuickenConfig

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.