// be close to it and be asked by another node to cache it!
DHTTransportContact originator = new_value.getOriginator();
DHTTransportContact sender = new_value.getSender();
HashWrapper originator_id = new HashWrapper( originator.getID());
boolean direct = Arrays.equals( originator.getID(), sender.getID());
if ( direct ){
// direct contact from the originator is straight forward
addDirectValue( originator_id, new_value );
// remove any indirect values we might already have for this
Iterator<Map.Entry<HashWrapper,DHTDBValueImpl>> it = indirect_originator_value_map.entrySet().iterator();
List<HashWrapper> to_remove = new ArrayList<HashWrapper>();
while( it.hasNext()){
Map.Entry<HashWrapper,DHTDBValueImpl> entry = it.next();
HashWrapper existing_key = entry.getKey();
DHTDBValueImpl existing_value = entry.getValue();
if ( Arrays.equals( existing_value.getOriginator().getID(), originator.getID())){
to_remove.add( existing_key );
}
}
for (int i=0;i<to_remove.size();i++){
removeIndirectValue((HashWrapper)to_remove.get(i));
}
}else{
// not direct. if we have a value already for this originator then
// we drop the value as the originator originated one takes precedence
if ( direct_originator_map_may_be_null != null &&
direct_originator_map_may_be_null.get( originator_id ) != null ){
return;
}
// rule (b) - one entry per originator/value pair
HashWrapper originator_value_id = getOriginatorValueID( new_value );
DHTDBValueImpl existing_value = indirect_originator_value_map.get( originator_value_id );
if ( existing_value != null ){