mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 07:02:29 +00:00
Update MHTClickTrainAlgorithm.java
Fix unsynchronised access to a datablock in click train detector which was causing index errors.
This commit is contained in:
parent
9a314b8a6b
commit
6a6026b152
@ -12,6 +12,7 @@ import PamUtils.PamCalendar;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
import PamguardMVC.debug.Debug;
|
||||
import clickTrainDetector.ClickTrainControl;
|
||||
import clickTrainDetector.ClickTrainDataBlock;
|
||||
import clickTrainDetector.TempCTDataUnit;
|
||||
import clickTrainDetector.CTDataUnit;
|
||||
import clickTrainDetector.clickTrainAlgorithms.CTAlgorithmInfo;
|
||||
@ -287,16 +288,19 @@ public class MHTClickTrainAlgorithm implements ClickTrainAlgorithm, PamSettings
|
||||
*/
|
||||
private synchronized void grabUnconfirmedTrains(MHTAlgorithm mhtAlgorithm) {
|
||||
|
||||
ListIterator<TempCTDataUnit> iterator = clickTrainControl.getClickTrainProcess().getUnconfirmedCTDataBlock().getListIterator(0);
|
||||
|
||||
//clear the data block
|
||||
TempCTDataUnit tempCTUnit;
|
||||
while (iterator.hasNext()) {
|
||||
tempCTUnit = iterator.next();
|
||||
tempCTUnit.removeAllSubDetections();
|
||||
tempCTUnit.clearSubdetectionsRemoved();
|
||||
ClickTrainDataBlock<TempCTDataUnit> unconfirmedBlock = clickTrainControl.getClickTrainProcess().getUnconfirmedCTDataBlock();
|
||||
synchronized (unconfirmedBlock.getSynchLock()) {
|
||||
ListIterator<TempCTDataUnit> iterator = unconfirmedBlock.getListIterator(0);
|
||||
|
||||
//clear the data block
|
||||
TempCTDataUnit tempCTUnit;
|
||||
while (iterator.hasNext()) {
|
||||
tempCTUnit = iterator.next();
|
||||
tempCTUnit.removeAllSubDetections();
|
||||
tempCTUnit.clearSubdetectionsRemoved();
|
||||
}
|
||||
unconfirmedBlock.clearAll();
|
||||
}
|
||||
clickTrainControl.getClickTrainProcess().getUnconfirmedCTDataBlock().clearAll();
|
||||
|
||||
if (mhtAlgorithm.mhtKernal.getActiveTracks()==null) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user