LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  April 2015

HPS-SVN April 2015

Subject:

r2727 - /java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Thu, 16 Apr 2015 22:57:00 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (133 lines)

Author: [log in to unmask]
Date: Thu Apr 16 15:56:54 2015
New Revision: 2727

Log:
Make sure session always disconnects by interrupting the processing thread if necessary.

Modified:
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java

Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java	Thu Apr 16 15:56:54 2015
@@ -246,13 +246,13 @@
      */
     synchronized void connect() throws IOException {
         // Setup the network connection if using an ET server.
-        if (usingEtServer()) {
+        if (this.usingEtServer()) {
             // Create a connection to the ET server.
             try {
                 this.logger.fine("connecting to ET system ...");
 
                 // Create the main ET system connection.
-                createEtConnection();
+                this.createEtConnection();
 
                 // FIXME: Separate event processing ET stations not currently used due to synchronization and ET issues.
 
@@ -324,8 +324,8 @@
     synchronized void disconnect() {
 
         // Cleanup the ET connection.
-        if (usingEtServer()) {
-            closeEtConnection();
+        if (this.usingEtServer()) {
+            this.closeEtConnection();
         }
 
         // Change application state to disconnected.
@@ -438,10 +438,10 @@
     void setup(final ConfigurationModel configurationModel) {
 
         // Setup LCSim from the configuration.
-        setupLcsim(configurationModel);
+        this.setupLcsim(configurationModel);
 
         // Now setup the CompositeLoop.
-        setupLoop(configurationModel);
+        this.setupLoop(configurationModel);
     }
 
     /**
@@ -484,14 +484,14 @@
 
             // Setup the event builder to translate from EVIO to LCIO.
             // This must happen before Driver setup so the builder's listeners are activated first!
-            createEventBuilder(configurationModel);
+            this.createEventBuilder(configurationModel);
 
             // Configure the job manager for the XML steering.
             this.sessionState.jobManager.setPerformDryRun(true);
             if (steeringType == SteeringType.RESOURCE) {
-                setupSteeringResource(steering);
+                this.setupSteeringResource(steering);
             } else if (steeringType.equals(SteeringType.FILE)) {
-                setupSteeringFile(steering);
+                this.setupSteeringFile(steering);
             }
 
             // Set conditions tag if applicable.
@@ -650,23 +650,37 @@
     synchronized void stop() {
 
         // Kill session watchdog thread.
-        killWatchdogThread();
+        this.killWatchdogThread();
 
         // Wake up all ET stations to unblock the system and make sure stations are detached properly.
-        if (usingEtServer()) {
-            wakeUpEtStations();
+        if (this.usingEtServer()) {
+            this.wakeUpEtStations();
         }
 
         // Stop the event processing now that ET system should be unblocked.
-        this.logger.fine("sending STOP command to loop ...");
+        this.logger.finer("sending STOP command to loop ...");
         this.sessionState.loop.execute(Command.STOP);
-        this.logger.fine("loop got command STOP");
-
-        // Cleanup the event processing thread since it was told to stop now.
+        this.logger.finer("loop got STOP command");
+
+        this.logger.finer("processing thread is alive: " + this.sessionState.processingThread.isAlive());
+
         try {
-            this.logger.fine("waiting for event processing thread to end ...");
+            // Give the event processing thread a chance to end cleanly.
+            this.logger.finer("waiting for event processing thread to end ...");
+            this.sessionState.processingThread.join(5000);
+            this.logger.finer("processing thread is alive: " + this.sessionState.processingThread.isAlive());
+            // this.logger.finer("event processing thread ended cleanly");
+        } catch (final InterruptedException e) {
+            e.printStackTrace();
+        }
+
+        try {
+            this.logger.finer("processing thread is alive: " + this.sessionState.processingThread.isAlive());
+            // In this case the thread needs to be interrupted and then joined.
+            this.logger.finer("interrupting event processing thread");
+            this.sessionState.processingThread.interrupt();
             this.sessionState.processingThread.join();
-            this.logger.fine("event processing thread ended");
+            this.logger.finer("event processing thread ended after interrupt");
         } catch (final InterruptedException e) {
             e.printStackTrace();
         }
@@ -681,10 +695,10 @@
         this.sessionState.loop = null;
 
         // Disconnect from the ET system.
-        disconnect();
+        this.disconnect();
 
         // Invalidate the event processing object so it is unusable now.
-        invalidate();
+        this.invalidate();
     }
 
     /**

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use