Package net.tomp2p.futures

Examples of net.tomp2p.futures.FutureDHT.awaitUninterruptibly()


    final Number160 hash = Number160.createHash(locationKey);
    FutureDHT request;
    try {
      request = p.get(hash).setRequestP2PConfiguration(reqParam).setAll()
          .start();
      request.awaitUninterruptibly();
      Data f = request.getData();
      if (!request.isSuccess() || f == null) {
        logger.debug(String.format("Got no triple in key \"%s\" (%s)",
            locationKey, hash));
        return new ArrayList<Triple>(0);
View Full Code Here


    l.log(TYPE_REMOVE, String.format("Peer %s: remove item %s in key: %s",
        p, item, locationKey), 10);
    final Number160 contentKey = Number160.createHash(item.toString());
    request = p.remove(hash).setContentKey(contentKey)
        .setReturnResults(false).start();
    request.awaitUninterruptibly();
    logger.debug(String.format("Remove triple in key %s (%s)", locationKey,
        hash));
  }

  @Override
View Full Code Here

    l.log(TYPE_REMOVE, String.format(
        "Peer %s: removed %d  item in key: %s", p, contentKeys.size(),
        locationKey), 10);
    request = p.remove(hash).setContentKeys(contentKeys)
        .setReturnResults(false).start();
    request.awaitUninterruptibly();
    logger.debug(String.format("Remove %d triples in key %s (%s)",
        contentKeys.size(), locationKey, hash));
  }

  /**
 
View Full Code Here

        valueToAdd = new Data(new TomP2P_Item<Triple>(locationKey, t));
      else
        valueToAdd = new Data(t);
      request = p.put(hash).setData(contentKey, valueToAdd)
          .setRequestP2PConfiguration(reqParam).start();
      request.awaitUninterruptibly();
      logger.debug(String.format("Insert triple %s in key %s (%s)", t,
          locationKey, hash));
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

      }
      map.put(contentKey, valueToAdd);
    }
    FutureDHT request = p.put(hash).setDataMap(map)
        .setRequestP2PConfiguration(reqParam).start();
    request.awaitUninterruptibly();
    logger.debug(String.format("Insert %d triple(s) in key %s (%s)",
        map.size(), locationKey, hash));
  }

  /*
 
View Full Code Here

      }
      list.add(valueToAdd);
    }
    FutureDHT request = p.add(hash).setDataSet(list)
        .setRequestP2PConfiguration(reqParam).start();
    request.awaitUninterruptibly();
    logger.debug(String.format("Insert %d triple(s) in key %s (%s)",
        list.size(), locationKey, hash));
  }

  @Override
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.