diff --git a/src/PamController/PamController.java b/src/PamController/PamController.java index df0728ce..82b514ad 100644 --- a/src/PamController/PamController.java +++ b/src/PamController/PamController.java @@ -165,7 +165,7 @@ public class PamController implements PamControllerInterface, PamSettings { /** * The current PAM status */ - private transient int pamStatus = PAM_IDLE; + private volatile int pamStatus = PAM_IDLE; /** * PamGuard view params. @@ -1382,6 +1382,7 @@ public class PamController implements PamControllerInterface, PamSettings { * @param sayEmpties dump info even if a buffer is empty (otherwise, only ones that have stuff still) */ public void dumpBufferStatus(String message, boolean sayEmpties) { + if (2 >1) return; System.out.println("**** Dumping process buffer status: " + message); ArrayList pamControlledUnits = pamConfiguration.getPamControlledUnits(); for (PamControlledUnit aUnit : pamControlledUnits) { @@ -1430,7 +1431,6 @@ public class PamController implements PamControllerInterface, PamSettings { pamControlledUnits.get(iU).flushDataBlockBuffers(2000); } } - setPamStatus(PAM_IDLE); dumpBufferStatus("In pamStopped, now idle", true); // wait here until the status has changed to Pam_Idle, so that we know @@ -1454,6 +1454,8 @@ public class PamController implements PamControllerInterface, PamSettings { long stopTime = PamCalendar.getTimeInMillis(); saveEndSettings(stopTime); + + setPamStatus(PAM_IDLE); // no good having this here since it get's called at the end of every file. // if (GlobalArguments.getParam(PamController.AUTOEXIT) != null) { @@ -2064,7 +2066,8 @@ public class PamController implements PamControllerInterface, PamSettings { /* * This only get's called once when set idle at viewer mode startup. */ -// System.out.printf("******* PamController.setPamStatus to %d, real status is %d\n", pamStatus, getRealStatus()); + System.out.printf("******* PamController.setPamStatus to %d, real status is %d set in thread %s\n", + pamStatus, getRealStatus(), Thread.currentThread().toString()); if (getRunMode() != RUN_PAMVIEW) { TopToolBar.enableStartButton(pamStatus == PAM_IDLE); TopToolBar.enableStopButton(pamStatus == PAM_RUNNING); diff --git a/src/PamguardMVC/PamDataBlock.java b/src/PamguardMVC/PamDataBlock.java index fd245638..3bcce61a 100644 --- a/src/PamguardMVC/PamDataBlock.java +++ b/src/PamguardMVC/PamDataBlock.java @@ -2164,7 +2164,7 @@ public class PamDataBlock extends PamObservable { */ @Override public String toString() { - return getDataName(); + return getLongDataName(); } /** diff --git a/src/binaryFileStorage/BinaryOutputStream.java b/src/binaryFileStorage/BinaryOutputStream.java index 1e474686..f8d5f59b 100644 --- a/src/binaryFileStorage/BinaryOutputStream.java +++ b/src/binaryFileStorage/BinaryOutputStream.java @@ -49,7 +49,7 @@ public class BinaryOutputStream { private DataOutputStream noiseOutputStream; - private int storedObjects; + private int storedObjects, storedNoiseCount; private String mainFileName, indexFileName; @@ -219,6 +219,7 @@ public class BinaryOutputStream { else { noiseOutputStream = null; } + storedNoiseCount = 0; return true; } @@ -450,6 +451,7 @@ public class BinaryOutputStream { footer.setHighestUID(parentDataBlock.getUidHandler().getCurrentUID()); boolean ok = footer.writeFooter(dataOutputStream, BinaryStore.getCurrentFileFormat()); if (noiseOutputStream != null) { + footer.setnObjects(storedNoiseCount); ok &= footer.writeFooter(noiseOutputStream, BinaryStore.getCurrentFileFormat()); } lastObjectType = BinaryTypes.FILE_FOOTER; @@ -487,12 +489,20 @@ public class BinaryOutputStream { // } public synchronized boolean storeData(int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) { + boolean ok; if (objectId == BinaryTypes.BACKGROUND_DATA & noiseOutputStream != null) { - return storeData(noiseOutputStream, objectId, baseData, binaryObjectData); + ok = storeData(noiseOutputStream, objectId, baseData, binaryObjectData); + if (ok) { + storedNoiseCount++; + } } else { - return storeData(dataOutputStream, objectId, baseData, binaryObjectData); + ok = storeData(dataOutputStream, objectId, baseData, binaryObjectData); + if (ok) { + storedObjects++; + } } + return ok; } /** * Writes data to a file. Note that the length of data may be greater than @@ -562,7 +572,6 @@ public class BinaryOutputStream { return false; } - storedObjects++; return true; diff --git a/src/pamScrollSystem/DataLoadQueData.java b/src/pamScrollSystem/DataLoadQueData.java index 77c143ab..93ed656c 100644 --- a/src/pamScrollSystem/DataLoadQueData.java +++ b/src/pamScrollSystem/DataLoadQueData.java @@ -1,5 +1,6 @@ package pamScrollSystem; +import PamUtils.PamCalendar; import PamguardMVC.PamDataBlock; /** @@ -68,6 +69,14 @@ public class DataLoadQueData { public void setDataEnd(long dataEnd) { this.dataEnd = dataEnd; } + + + @Override + public String toString() { + String str = String.format("%s %s - %s", pamDataBlock.getLongDataName(), + PamCalendar.formatDBDateTime(dataStart),PamCalendar.formatDBDateTime(dataEnd)); + return str; + } }