@Override protected LookupRequest createLookupRequest(Contact node) { Collection<KUID> noKeys = Collections.emptySet(); return context .getMessageHelper() .createFindValueRequest( node.getContactAddress(), lookupId, noKeys, lookupKey.getDHTValueType()); }
private boolean extractDataFromResponse(FindValueResponse response) { Contact sender = response.getContact(); Collection<KUID> availableSecondaryKeys = response.getSecondaryKeys(); Collection<? extends DHTValueEntity> entities = response.getDHTValueEntities(); // No keys and no values? In other words the remote Node sent us // a FindValueResponse even though it doesn't have a value for // the given KUID!? Continue with the lookup if so...! if (availableSecondaryKeys.isEmpty() && entities.isEmpty()) { if (LOG.isWarnEnabled()) { LOG.warn(sender + " returned neither keys nor values for " + lookupId); } // Continue with the lookup... return false; } Collection<? extends DHTValueEntity> filtered = DatabaseUtils.filter(lookupKey.getDHTValueType(), entities); // The filtered Set is empty and the unfiltered isn't? // The remote Node send us unrequested Value(s)! // Continue with the lookup if so...! if (filtered.isEmpty() && !entities.isEmpty()) { if (LOG.isWarnEnabled()) { LOG.warn(sender + " returned unrequested types of values for " + lookupId); } // Continue with the lookup... return false; } this.entities.addAll(filtered); for (KUID secondaryKey : availableSecondaryKeys) { EntityKey key = EntityKey.createEntityKey(sender, lookupId, secondaryKey, lookupKey.getDHTValueType()); this.entityKeys.add(key); } return true; }