From c64fa8fe9d90b29d4afabc5f967453d9635e8126 Mon Sep 17 00:00:00 2001 From: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com> Date: Thu, 7 Mar 2024 11:24:20 +0000 Subject: [PATCH] opt to easily turn off restart debug output --- src/PamController/PamController.java | 13 +++++++++---- src/PamModel/PamModel.java | 19 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/PamController/PamController.java b/src/PamController/PamController.java index 15b19eac..dfa37f56 100644 --- a/src/PamController/PamController.java +++ b/src/PamController/PamController.java @@ -195,6 +195,8 @@ public class PamController implements PamControllerInterface, PamSettings { private static PamController uniqueController; private Timer diagnosticTimer; + + private boolean debugDumpBufferAtRestart = false; private NetworkController networkController; private int nNetPrepared; @@ -1263,7 +1265,7 @@ public class PamController implements PamControllerInterface, PamSettings { saveSettings(PamCalendar.getSessionStartTime()); } - if (++nStarts > 1) { + if (++nStarts > 1 && debugDumpBufferAtRestart) { // do this here - all processses should have reset buffers to start again by now. String msg = String.format("Starting PAMGuard go %d", nStarts); dumpBufferStatus(msg, false); @@ -1382,7 +1384,8 @@ 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; + if (debugDumpBufferAtRestart == false) return; + System.out.println("**** Dumping process buffer status: " + message); ArrayList pamControlledUnits = pamConfiguration.getPamControlledUnits(); for (PamControlledUnit aUnit : pamControlledUnits) { @@ -2066,8 +2069,10 @@ 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 set in thread %s\n", - pamStatus, getRealStatus(), Thread.currentThread().toString()); + if (debugDumpBufferAtRestart) { + 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/PamModel/PamModel.java b/src/PamModel/PamModel.java index 231887c3..d2bcb919 100644 --- a/src/PamModel/PamModel.java +++ b/src/PamModel/PamModel.java @@ -23,6 +23,7 @@ package PamModel; import java.io.File; import java.io.FileNotFoundException; import java.io.Serializable; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; @@ -1212,13 +1213,15 @@ final public class PamModel implements PamSettings { if (intf[j].getName().equals("PamModel.PamPluginInterface")) { // create an instance of the interface class. - PamPluginInterface pf = (PamPluginInterface) c.newInstance(); + Constructor constructor = c.getDeclaredConstructor(null); + PamPluginInterface pf = (PamPluginInterface) constructor.newInstance(null); if (getPluginBeingLoaded()==null) { continue; } // Let the user know which valid plugins have been found - System.out.println(" Creating instance of " + pf.getDefaultName() + ": " + pf.getClassName()); + System.out.printf(" Loading plugin interface for %s : %s version %s\n", + pf.getDefaultName(), pf.getClassName(), pf.getVersion()); if (getPluginBeingLoaded()==null) { continue; } @@ -1234,7 +1237,7 @@ final public class PamModel implements PamSettings { pluginList.add(pf); // add it to the list } else { - System.out.println(" Error: "+pf.getDefaultName()+" cannot run in this mode. Skipping module."); + System.out.println(" Error: " + pf.getDefaultName()+" cannot run in this mode. Skipping module."); } if (getPluginBeingLoaded()==null) { continue; @@ -1243,12 +1246,16 @@ final public class PamModel implements PamSettings { // now check for interfaces that implement DaqSystemInterface if (intf[j].getName().equals("Acquisition.DaqSystemInterface")) { - DaqSystemInterface pf = (DaqSystemInterface) c.newInstance(); // create an instance of the interface class + Constructor constructor = c.getDeclaredConstructor(null); + DaqSystemInterface pf = (DaqSystemInterface) constructor.newInstance(null); +// DaqSystemInterface pf = (DaqSystemInterface) c.newInstance(); // create an instance of the interface class if (getPluginBeingLoaded()==null) { continue; } - - System.out.println(" Creating instance of " + pf.getDefaultName() + ": " + className); + + System.out.printf(" Loading daq plugin interface for %s version %s\n", + pf.getDefaultName(), pf.getVersion()); +// System.out.println(" Creating instance of " + pf.getDefaultName() + ": " + className); if (getPluginBeingLoaded()==null) { continue; }