Package org.ardverk.dht.message

Examples of org.ardverk.dht.message.MessageFactory


      }
    }
  }
 
  private synchronized void store(Contact dst) throws IOException {
    MessageFactory factory = getMessageFactory();
    StoreRequest request = factory.createStoreRequest(dst, key, value);
   
    long defaultTimeout = config.getStoreTimeoutInMillis();
    long adaptiveTimeout = config.getAdaptiveTimeout(
        dst, defaultTimeout, TimeUnit.MILLISECONDS);
   
View Full Code Here


   
    Contact src = request.getContact();
    Key key = request.getKey();
    Value value = datastore.get(src, key);
   
    MessageFactory factory = getMessageFactory();
    ResponseMessage response = null;
   
    if (value != null) {
      response = factory.createValueResponse(request, value);
    } else {
      Contact[] contacts = routeTable.select(key.getId());
      response = factory.createNodeResponse(request, contacts);
    }
   
    return response;
  }
View Full Code Here

 
  @Override
  protected void lookup(Contact dst, KUID lookupId,
      long timeout, TimeUnit unit) throws IOException {
   
    MessageFactory factory = getMessageFactory();
    NodeRequest message = factory.createNodeRequest(dst, lookupId);
    send(dst, message, timeout, unit);
  }
View Full Code Here

  public PingRequestHandler(Provider<MessageDispatcher> messageDispatcher) {
    super(messageDispatcher);
  }

  public PingResponse createResponse(PingRequest request) {
    MessageFactory factory = getMessageFactory();
    return factory.createPingResponse(request);
  }
View Full Code Here

  @Override
  public ResponseMessage handleRequest(RequestMessage message) throws IOException {
    StoreRequest request = (StoreRequest)message;
    Value value = store(request);
   
    MessageFactory factory = getMessageFactory();
    return factory.createStoreResponse(request, value);
  }
View Full Code Here

      this.address = address;
    }
 
    @Override
    public void ping() throws IOException {
      MessageFactory factory = getMessageFactory();
      PingRequest request = factory.createPingRequest(address);
     
      long timeout = config.getPingTimeout(TimeUnit.MILLISECONDS);
      send(contactId, request, timeout, TimeUnit.MILLISECONDS);
    }
View Full Code Here

      this.contact = contact;
    }
   
    @Override
    public void ping() throws IOException {
      MessageFactory factory = getMessageFactory();
      PingRequest request = factory.createPingRequest(contact);
     
      long timeout = config.getPingTimeoutInMillis();
      long adaptiveTimeout = config.getAdaptiveTimeout(
          contact, timeout, TimeUnit.MILLISECONDS);
      send(contact, request, adaptiveTimeout, TimeUnit.MILLISECONDS);
View Full Code Here

      contacts = kContacts;
    }*/
   
    Contact[] contacts = routeTable.select(lookupId);
   
    MessageFactory factory = getMessageFactory();
    return factory.createNodeResponse(request, contacts);
  }
View Full Code Here

  protected void lookup(Contact dst, KUID lookupId,
      long timeout, TimeUnit unit) throws IOException {
   
    assert (lookupId.equals(key.getId()));
   
    MessageFactory factory = getMessageFactory();
    ValueRequest message = factory.createValueRequest(dst, key);
   
    send(dst, message, timeout, unit);
  }
View Full Code Here

TOP

Related Classes of org.ardverk.dht.message.MessageFactory

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.