Skip to content

Commit

Permalink
Synchronize the CSV row writing
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrowlands committed Nov 7, 2023
1 parent f59f2aa commit 0a1bceb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ String[] getHeaderComments()
}

@Override
public void onBluetoothSurveyRecord(BluetoothRecord bluetoothRecord)
public synchronized void onBluetoothSurveyRecord(BluetoothRecord bluetoothRecord)
{
try
{
Expand All @@ -71,7 +71,7 @@ public void onBluetoothSurveyRecord(BluetoothRecord bluetoothRecord)
}

@Override
public void onBluetoothSurveyRecords(List<BluetoothRecord> bluetoothRecords)
public synchronized void onBluetoothSurveyRecords(List<BluetoothRecord> bluetoothRecords)
{
bluetoothRecords.forEach(record -> {
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class CsvRecordLogger
private static final int RECORD_COUNT_INTERVAL = 5000;

/**
* A lock to synchronize the writing of single records and the creation of a new GeoPackage file
* A lock to synchronize the writing of single records and the creation of a new CSV file
* during rollover.
*/
protected final Object csvFileLock = new Object();
Expand Down Expand Up @@ -144,7 +144,7 @@ public boolean enableLogging(boolean enable)
}
}

void writeCsvRecord(Object[] row, boolean flush) throws IOException
synchronized void writeCsvRecord(Object[] row, boolean flush) throws IOException
{
if (lazyFileCreation) lazyCreateFileIfNecessary();
printer.printRecord(row);
Expand Down

0 comments on commit 0a1bceb

Please sign in to comment.