cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r618873 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/ rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/
Date Wed, 06 Feb 2008 03:58:02 GMT
Author: dkulp
Date: Tue Feb  5 19:58:02 2008
New Revision: 618873

URL: http://svn.apache.org/viewvc?rev=618873&view=rev
Log:
Merged revisions 618851 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r618851 | dkulp | 2008-02-05 20:39:31 -0500 (Tue, 05 Feb 2008) | 3 lines
  
  [CXF-1412] NPE in ClientFaultConverter
  Create RM timer on demand so you don't have timer threads sitting around when RM not used
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
    incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
    incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?rev=618873&r1=618872&r2=618873&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
Tue Feb  5 19:58:02 2008
@@ -195,7 +195,7 @@
         String ss = (String) xu.getValue("//" + Fault.STACKTRACE + "/text()", fault.getDetail(),
                 XPathConstants.STRING);
         List<StackTraceElement> stackTraceList = new ArrayList<StackTraceElement>();
-        if (StringUtils.isEmpty(ss)) {
+        if (!StringUtils.isEmpty(ss)) {
             StringTokenizer st = new StringTokenizer(ss, "\n");
             while (st.hasMoreTokens()) {
                 String oneLine = st.nextToken();

Modified: incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?rev=618873&r1=618872&r2=618873&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
Tue Feb  5 19:58:02 2008
@@ -24,6 +24,7 @@
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Timer;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -78,7 +79,7 @@
     private SequenceIdentifierGenerator idGenerator;
     private RetransmissionQueue retransmissionQueue;
     private Map<Endpoint, RMEndpoint> reliableEndpoints = new HashMap<Endpoint,
RMEndpoint>();
-    private Timer timer = new Timer("RMManager-Timer-" + System.identityHashCode(this), true);
+    private AtomicReference<Timer> timer = new AtomicReference<Timer>();
     private RMAssertion rmAssertion;
     private DeliveryAssuranceType deliveryAssurance;
     private SourcePolicyType sourcePolicy;
@@ -157,8 +158,18 @@
         idGenerator = generator;
     }
 
+    private Timer getTimer(boolean create) {
+        Timer ret = timer.get();
+        if (ret == null && create) {
+            Timer newt = new Timer("RMManager-Timer-" + System.identityHashCode(this), true);
+            if (!timer.compareAndSet(null, newt)) {
+                newt.cancel();
+            }
+        }
+        return timer.get();
+    }
     public Timer getTimer() {
-        return timer;
+        return getTimer(true);
     }
 
     public BindingFaultFactory getBindingFaultFactory(Binding binding) {
@@ -349,8 +360,11 @@
 
         // remove references to timer tasks cancelled above to make them
         // eligible for garbage collection
-        timer.purge();
-        timer.cancel();
+        Timer t = getTimer(false);
+        if (t != null) {
+            t.purge();
+            t.cancel();
+        }
     }
     
     synchronized void shutdownReliableEndpoint(Endpoint e) {
@@ -364,7 +378,10 @@
         
         // remove references to timer tasks cancelled above to make them
         // eligible for garbage collection
-        timer.purge();
+        Timer t = getTimer(false);
+        if (t != null) {
+            t.purge();
+        }
         
         reliableEndpoints.remove(e);
     }

Modified: incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java?rev=618873&r1=618872&r2=618873&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
Tue Feb  5 19:58:02 2008
@@ -421,6 +421,7 @@
         Endpoint e = control.createMock(Endpoint.class);
         RMEndpoint rme = control.createMock(RMEndpoint.class);
         manager.getReliableEndpointsMap().put(e, rme);
+        manager.getTimer(); //start the timer
         rme.shutdown();
         EasyMock.expectLastCall();
         assertNotNull(manager);



Mime
View raw message