mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-21 22:52:22 +00:00
Merge branch 'restart' of https://github.com/douggillespie/PAMGuard into restart
This commit is contained in:
commit
e3ffd56f69
@ -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<PamControlledUnit> 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);
|
||||
|
@ -2164,7 +2164,7 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return getDataName();
|
||||
return getLongDataName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user