Improvements for batch processing (#104)

* Update FileListWorker.java

* Support batch processing

Multicast controller and a couple of additional commands to work with
the batch processing plugin.

* Database float unpack

Better unpacking checks of floats coming back from the database

* Batch changes

Changes in support of batch processing

* Small changes for batch processing
This commit is contained in:
Douglas Gillespie 2023-04-19 09:05:25 +01:00 committed by GitHub
parent 57bae3c39c
commit 6a0c9b55d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 11 deletions

View File

@ -47,6 +47,8 @@ public class PamCalendar {
public static TimeZone defaultTimeZone = TimeZone.getTimeZone("UTC"); public static TimeZone defaultTimeZone = TimeZone.getTimeZone("UTC");
private static TimeZone localTimeZone = TimeZone.getDefault();
public static final long millisPerDay = 1000L*24L*3600L; public static final long millisPerDay = 1000L*24L*3600L;
/** /**
@ -174,8 +176,9 @@ public class PamCalendar {
} }
public static TimeZone getDisplayTimeZone(boolean useLocal) { public static TimeZone getDisplayTimeZone(boolean useLocal) {
return TimeZone.getTimeZone("UTC"); // return TimeZone.getTimeZone("UTC");
// return useLocal ? CalendarControl.getInstance().getChosenTimeZone() : defaultTimeZone; // return useLocal ? CalendarControl.getInstance().getChosenTimeZone() : defaultTimeZone;
return useLocal ? localTimeZone : defaultTimeZone;
} }
public static String formatDateTime(Date date) { public static String formatDateTime(Date date) {

View File

@ -106,6 +106,13 @@ public abstract class DataBlockTableView<T extends PamDataUnit> {
} }
} }
/**
* Call the table data changed function to update table values.
*/
public void fireTableDataChanged() {
blockTableModel.fireTableDataChanged();
}
public JComponent getComponent() { public JComponent getComponent() {
return tablePanel; return tablePanel;
} }
@ -150,13 +157,22 @@ public abstract class DataBlockTableView<T extends PamDataUnit> {
String tip = null; String tip = null;
java.awt.Point p = e.getPoint(); java.awt.Point p = e.getPoint();
int rowIndex = rowAtPoint(p); int rowIndex = rowAtPoint(p);
// int column = columnAtPoint(p);
// System.out.println("Get tooltip for row " + rowIndex + " column" + column);
if (rowIndex < 0) { if (rowIndex < 0) {
return null; return null;
} }
int colIndex = columnAtPoint(p); int colIndex = columnAtPoint(p);
int realColumnIndex = convertColumnIndexToModel(colIndex); int realColumnIndex = convertColumnIndexToModel(colIndex);
T dataUnit = getDataUnit(rowIndex); try {
return DataBlockTableView.this.getToolTipText(dataUnit, realColumnIndex); T dataUnit = getDataUnit(rowIndex);
return DataBlockTableView.this.getToolTipText(dataUnit, realColumnIndex);
}
catch (Exception ex) {
// I once got an index out of bounds here, or it might have been
// a concurrent modification exception ? Either way return null;
return null;
}
} }
} }
@ -226,13 +242,16 @@ public abstract class DataBlockTableView<T extends PamDataUnit> {
/** /**
* Get the number of rows in the table - default behaviour is the * Get the number of rows in the table - default behaviour is the
* number of rows in the datablock, but this may be overridded if * number of rows in the datablock, but this may be overridden if
* data are being selected in a different way. * data are being selected in a different way.
* @return number of table rows to show. * @return number of table rows to show.
*/ */
public int getRowCount() { public int getRowCount() {
if (dataUnitCopy == null) { if (dataUnitCopy == null) {
return 0; updatePamData();
if (dataUnitCopy == null) {
return 0;
}
} }
return dataUnitCopy.size(); return dataUnitCopy.size();
} }

View File

@ -177,7 +177,7 @@ public class RWEProcess extends PamProcess {
minSoundType = rweControl.rweParameters.minSoundType; minSoundType = rweControl.rweParameters.minSoundType;
classifier.setSoundData(getSampleRate(), sourceDataBlock.getFftLength(), classifier.setSoundData(getSampleRate(), sourceDataBlock.getFftLength(),
sourceDataBlock.getFftHop()); sourceDataBlock.getFftHop());
System.out.println("Create right whale channel process " + iChannel); // System.out.println("Create right whale channel process " + iChannel);
} }

View File

@ -46,7 +46,7 @@ public class BinaryStoreProcess extends PamProcess {
startTime = PamCalendar.getTimeInMillis(); startTime = PamCalendar.getTimeInMillis();
long round = binaryStore.binaryStoreSettings.fileSeconds * 1000; long round = binaryStore.binaryStoreSettings.fileSeconds * 1000;
nextFileTime = (startTime/round) * round + round; nextFileTime = (startTime/round) * round + round;
System.out.println("Next file start at " + PamCalendar.formatDateTime(nextFileTime)); // System.out.println("Next file start at " + PamCalendar.formatDateTime(nextFileTime));
timer = new Timer(); timer = new Timer();
timer.schedule(new FileTimerTask(), 1000, 1000); timer.schedule(new FileTimerTask(), 1000, 1000);

View File

@ -412,8 +412,9 @@ PamSettingsSource {
} }
if (dbParameters.getUseAutoCommit() == false) { // if (dbParameters.getUseAutoCommit() == false) {
JMenuItem commitItem = new JMenuItem("Commit Changes"); JMenuItem commitItem = new JMenuItem("Commit Changes");
commitItem.setEnabled(dbParameters.getUseAutoCommit() == false);
commitItem.setToolTipText("Immediately commit recent changes to the database"); commitItem.setToolTipText("Immediately commit recent changes to the database");
commitItem.addActionListener(new ActionListener() { commitItem.addActionListener(new ActionListener() {
@Override @Override
@ -422,7 +423,7 @@ PamSettingsSource {
} }
}); });
menu.add(commitItem); menu.add(commitItem);
} // }
if (SMRUEnable.isEnable()) { if (SMRUEnable.isEnable()) {
JMenuItem speedMenu = new JMenuItem("Test database speed"); JMenuItem speedMenu = new JMenuItem("Test database speed");

View File

@ -279,7 +279,9 @@ public class SqliteSystem extends DBSystem implements PamSettings {
{ {
if(connection != null){ if(connection != null){
// if (USEAUTOCOMMIT == false) { // if (USEAUTOCOMMIT == false) {
connection.getConnection().commit(); if (connection.getConnection().getAutoCommit()) {
connection.getConnection().commit();
}
// } // }
connection.getConnection().close(); connection.getConnection().close();
} }