cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1347006 - in /cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom: AtomPushEngine.java AtomPushHandler.java
Date Wed, 06 Jun 2012 17:57:00 GMT
Author: dkulp
Date: Wed Jun  6 17:57:00 2012
New Revision: 1347006

URL: http://svn.apache.org/viewvc?rev=1347006&view=rev
Log:
Merged revisions 1346532 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1346532 | dkulp | 2012-06-05 14:57:34 -0400 (Tue, 05 Jun 2012) | 3 lines

  When the AtomPushHandler is closed, wait for a bit to see if the events
  can be flushed and delivered to avoid potential System.err messages

........

Modified:
    cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushEngine.java
    cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushHandler.java

Modified: cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushEngine.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushEngine.java?rev=1347006&r1=1347005&r2=1347006&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushEngine.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushEngine.java
Wed Jun  6 17:57:00 2012
@@ -25,6 +25,7 @@ import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.abdera.model.Element;
 import org.apache.commons.lang.Validate;
@@ -96,6 +97,15 @@ final class AtomPushEngine {
             publishAndReset();
         }
         executor.shutdown();
+        
+        try {
+            //wait a little to try and flush the batches
+            //it's not critical, but can avoid errors on the 
+            //console and such which could be confusing
+            executor.awaitTermination(20, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+            //ignore
+        }
     }
 
     private boolean isValid() {

Modified: cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushHandler.java?rev=1347006&r1=1347005&r2=1347006&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushHandler.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPushHandler.java
Wed Jun  6 17:57:00 2012
@@ -142,6 +142,9 @@ public final class AtomPushHandler exten
                 lazyConfig = false;
                 configure();
             }
+            if (engine == null) {
+                return;
+            }
             LogRecord rec = LogRecord.fromJUL(record);
             engine.publish(rec);
         } finally {
@@ -151,7 +154,10 @@ public final class AtomPushHandler exten
 
     @Override
     public synchronized void close() throws SecurityException {
-        engine.shutdown();
+        if (engine != null) {
+            engine.shutdown();
+        }
+        engine = null;
     }
 
     @Override



Mime
View raw message