Commit in hps-java/src/main/java/org/lcsim/hps/monitoring on MAIN | |||
MonitoringApplicationMain.java | -132 | 1.2 removed |
removing outdated class
diff -N MonitoringApplicationMain.java --- MonitoringApplicationMain.java 4 Apr 2012 23:26:07 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,132 +0,0 @@
-package org.lcsim.hps.monitoring; - -import java.nio.ByteBuffer; - -import javax.swing.SwingUtilities; - -import org.jlab.coda.et.EtAttachment; -import org.jlab.coda.et.EtEvent; -import org.jlab.coda.et.EtSystem; -import org.jlab.coda.et.enums.Mode; -import org.jlab.coda.et.enums.Modify; -import org.jlab.coda.et.exception.EtTimeoutException; -import org.jlab.coda.jevio.EvioEvent; -import org.jlab.coda.jevio.EvioReader; -import org.lcsim.hps.monitoring.ConnectionStatusPanel.ConnectionStatus; - -/** - * This runs the {@link MonitoringApplication} without any LCSim binding. - * @author Jeremy McCormick <[log in to unmask]> - */ -public class MonitoringApplicationMain { - - public MonitoringApplicationMain() - {} - - public static void main(String [] args) { - MonitoringApplicationMain app = new MonitoringApplicationMain(); - app.run(); - } - - public void run() - { - // Start the GUI. - final MonitoringApplication gui = new MonitoringApplication(); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - gui.start(); - } - }); - - // Get ConnectionPanel which can be used to connect/disconnect from ET system. - ConnectionPanel connectionPanel = gui.getConnectionPanel(); - - // GUI loop. Use 'Exit' command from GUI to quit. - while (true) { - - // Wait for connection request from GUI. - while (!connectionPanel.connectRequested()) { - try { Thread.sleep(1000); } catch (InterruptedException e) {}; - } - ConnectionParameters cn = connectionPanel.getConnectionParameters(); - - // This makes sure applicable menu items are enabled/disabled. - gui.connect(); - gui.getConnectionStatusPanel().setStatus(ConnectionStatus.CONNECTING); - - // Try block is mostly for EtExceptions and friends. - try { - - // Setup connection to ET system. - EtConnection et = EtConnection.createEtConnection(cn); - EtSystem sys = et.getEtSystem(); - EtAttachment att = et.getEtAttachment(); - - // Start job timer. - EventPanel eventPanel = gui.getEventPanel(); - eventPanel.updateJobStartTime(); - - // array of events - EtEvent[] mevs = null; - - Mode waitMode = cn.waitMode; - int waitTime = cn.waitTime; - int chunk = cn.chunk; - - gui.getConnectionStatusPanel().setStatus(ConnectionStatus.CONNECTED); - - // EtEvent loop. - while (true) { - try { - // Get EtEvents. - mevs = sys.getEvents(att, waitMode, Modify.NOTHING, waitTime, chunk); - - // Loop over retrieved EtEvents. - for (EtEvent mev : mevs) { - - // Update GUI's event count. - eventPanel.updateEventCount(); - - // Get EvioEvent and check for errors. - ByteBuffer buf = mev.getDataBuffer(); - EvioReader reader = new EvioReader(buf); - EvioEvent evioEvent = null; - try { - evioEvent = reader.parseNextEvent(); - } catch (java.nio.BufferUnderflowException e) { - // Error will be caught by subsequent check on null event. - } - if (evioEvent == null) { - eventPanel.updateBadEventCount(); - continue; - } - - // Update the average event rate. - eventPanel.updateAverageEventRate(); - - // Update elapsed time. - eventPanel.updateElapsedTime(); - } - - // Put events back into the ET system. - sys.putEvents(att, mevs); - - // Break out of event loop if GUI wants disconnect. - if (connectionPanel.disconnectRequested()) { - gui.getConnectionStatusPanel().setStatus(ConnectionStatus.DISCONNECTING); - gui.disconnect(); - break; - } - // Session timed out. - } catch (EtTimeoutException e) { - gui.getConnectionStatusPanel().setStatus(ConnectionStatus.TIMED_OUT); - break; - } - } - } catch (Exception ex) { - System.out.println("Error using ET system as consumer."); - ex.printStackTrace(); - } - } - } -}
\ No newline at end of file
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1