boolean got_new_or_changed_result = false;
SubscriptionResultImpl[] existing_results = manager.loadResults( subs );
ByteArrayHashMap result_key_map = new ByteArrayHashMap();
ByteArrayHashMap result_key2_map = new ByteArrayHashMap();
List new_results = new ArrayList();
for (int i=0;i<existing_results.length;i++){
SubscriptionResultImpl r = existing_results[i];
result_key_map.put( r.getKey1(), r );
byte[] key2 = r.getKey2();
if ( key2 != null ){
result_key2_map.put( key2, r );
}
new_results.add( r );
if ( !r.isDeleted()){
if ( r.getRead()){
new_read++;
}else{
new_unread++;
}
}
}
for (int i=0;i<latest_results.length;i++){
SubscriptionResultImpl r = latest_results[i];
// we first of all insist on names uniqueness
SubscriptionResultImpl existing = (SubscriptionResultImpl)result_key_map.get( r.getKey1());
if ( existing == null ){
// only if non-unique name do we fall back and use UID to remove duplicate
// entries where the name has changed
byte[] key2 = r.getKey2();
if ( key2 != null ){
existing = (SubscriptionResultImpl)result_key2_map.get( key2 );
}
}
if ( existing == null ){
last_new_result = now;
new_results.add( r );
result_key_map.put( r.getKey1(), r );
byte[] key2 = r.getKey2();
if ( key2 != null ){
result_key2_map.put( key2, r );
}
got_new_or_changed_result = true;
if ( r.getRead()){