protected void fireScanStateChanged() {
ScanStatusEvent event = new ScanStatusEvent(this);
ArrayList<WeakReference<IScanStatusListener>> toRemove = new ArrayList<WeakReference<IScanStatusListener>>();
synchronized (listeners) {
for (WeakReference<IScanStatusListener> ref : listeners) {
IScanStatusListener toWarn = ref.get();
if (toWarn == null) {
toRemove.add(ref);
}
else {
toWarn.stateChanged(event);
}
}
listeners.removeAll(toRemove);
}
toRemove.clear();