Package org.ardverk.dht.routing

Examples of org.ardverk.dht.routing.Contact


    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();
       
View Full Code Here


  private volatile int current = 0;
 
  public PainterPanel(DHT dht) {
    this.dht = dht;
   
    Contact localhost = dht.getIdentity();
    KUID localhostId = localhost.getId();
   
    painters.add(new JuicePainter(localhostId));
    painters.add(new SquashPainter(localhostId));
   
    addMouseListener(new MouseAdapter() {
View Full Code Here

  private DatastoreUtils() {}
 
  public static boolean isInBucket(Key key, RouteTable routeTable) {
    KUID bucketId = key.getId();
    Contact[] contacts = routeTable.select(bucketId);
    Contact localhost = routeTable.getIdentity();
   
    if (!ArrayUtils.contains(localhost, contacts)) {
      return false;
    }
   
View Full Code Here

      while (counter.hasNext() && counter.getCount() < w) {
        if (!it.hasNext()) {
          break;
        }
       
        Contact dst = it.next();
        store(dst);
       
        counter.increment();
      }
     
View Full Code Here

 
  @Override
  public ResponseMessage handleRequest(RequestMessage message) throws IOException {
    ValueRequest request = (ValueRequest)message;
   
    Contact src = request.getContact();
    Key key = request.getKey();
    Value value = datastore.get(src, key);
   
    MessageFactory factory = getMessageFactory();
    ResponseMessage response = null;
View Full Code Here

  @Override
  protected synchronized void processResponse0(RequestEntity entity,
      ResponseMessage response, long time, TimeUnit unit)
      throws IOException {
   
    Contact src = response.getContact();
    Contact[] contacts = ((NodeResponse)response).getContacts();
    processContacts(src, contacts, time, unit);
  }
View Full Code Here

          LOG.error("Multiple respones: " + response);
        }
        return false;
      }
     
      Contact contact = response.getContact();
      if (!factory.isFor(messageId, contact.getRemoteAddress())) {
        if (LOG.isErrorEnabled()) {
          LOG.error("Wrong MessageId signature: " + response);
        }
        return false;
      }
View Full Code Here

  private boolean checkContactId(ResponseMessage response) {
    if (contactId == null) {
      return (response instanceof PingResponse);
    }
   
    Contact contact = response.getContact();
    KUID otherId = contact.getId();
   
    return contactId.equals(otherId);
  }
View Full Code Here

    return new DefaultPingRequest(messageId, localhost, dst);
  }

  @Override
  public PingResponse createPingResponse(PingRequest request) {
    Contact dst = request.getContact();
    SocketAddress address = dst.getRemoteAddress();
    MessageId messageId = request.getMessageId();
    return new DefaultPingResponse(messageId, localhost, address);
  }
View Full Code Here

    return new DefaultNodeRequest(messageId, localhost, address, key);
  }

  @Override
  public NodeResponse createNodeResponse(LookupRequest request, Contact[] contacts) {
    Contact dst = request.getContact();
    SocketAddress address = dst.getRemoteAddress();
    MessageId messageId = request.getMessageId();
    return new DefaultNodeResponse(messageId, localhost, address, contacts);
  }
View Full Code Here

TOP

Related Classes of org.ardverk.dht.routing.Contact

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.