NIFI-5280:

- Preventing duplicate bulletins that are registried under different contexts (e.g. Controller and Component).

This closes #2771.

Signed-off-by: Mark Payne <markap14@hotmail.com>
This commit is contained in:
Matt Gilman 2018-06-07 13:37:57 -04:00 committed by Mark Payne
parent d2fd7e5e7d
commit c412445a1f
1 changed files with 4 additions and 5 deletions

View File

@ -26,6 +26,8 @@ import org.apache.nifi.util.RingBuffer.Filter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
@ -115,7 +117,7 @@ public class VolatileBulletinRepository implements BulletinRepository {
}
};
final List<Bulletin> selected = new ArrayList<>();
final Set<Bulletin> selected = new TreeSet<>();
int max = bulletinQuery.getLimit() == null ? Integer.MAX_VALUE : bulletinQuery.getLimit();
for (final ConcurrentMap<String, RingBuffer<Bulletin>> componentMap : bulletinStoreMap.values()) {
@ -129,10 +131,7 @@ public class VolatileBulletinRepository implements BulletinRepository {
}
}
// sort by descending ID
Collections.sort(selected);
return selected;
return new ArrayList<>(selected);
}
@Override