hatch : start msg thread before printing to ensure failed jobs don't kill the whole...
authorBill Erickson <berick@esilibrary.com>
Thu, 24 Apr 2014 20:29:17 +0000 (16:29 -0400)
committerJeff Godin <jgodin@tadl.org>
Fri, 3 Jun 2016 20:38:49 +0000 (16:38 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
src/org/evergreen_ils/hatch/Hatch.java
src/org/evergreen_ils/hatch/PrintManager.java

index 60e8d05..7e9ad74 100644 (file)
@@ -168,14 +168,6 @@ public class Hatch extends Application {
                     Platform.runLater(new Runnable() {
                         @Override public void run() {
                             new PrintManager().print(browser.webEngine, params);
-                            
-                            // don't start a new message listener thread
-                            // until we are done with this print call.
-                            // otherwise, we risk running parallel print
-                            // operations and that could be bad... not sure.
-                            // In the meantime, pending messages will be 
-                            // sitting in the WebSocket input buffers.
-                            startMsgTask();
                         }
                     });
                 }
@@ -183,6 +175,10 @@ public class Hatch extends Application {
 
         logger.info("printing " + content.length() + " bytes of " + contentType);
         browser.webEngine.loadContent(content, contentType);
+
+        // After queueing up the HTML for printing, go back to listening
+        // for new messages.
+        startMsgTask();
     }
 
     /**
index bfe908c..f2dea53 100644 (file)
@@ -116,7 +116,11 @@ public class PrintManager {
             logger.info("No print dialog requested");
         }
 
-        logger.info("printing...");
+        Thread[] all = new Thread[100];
+        int count = Thread.currentThread().enumerate(all);
+        logger.info(count + " active threads in print");
+        logger.info("Thread " + Thread.currentThread().getId() + " printing...");
+
         engine.print(job);
         logger.info("after print");