servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r579625 - /incubator/servicemix/branches/servicemix-3.1/common/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java
Date Wed, 26 Sep 2007 12:01:19 GMT
Author: gnodet
Date: Wed Sep 26 05:01:18 2007
New Revision: 579625

URL: http://svn.apache.org/viewvc?rev=579625&view=rev
Log:
SM-1061: Race condition in RSS feed-writer component

Modified:
    incubator/servicemix/branches/servicemix-3.1/common/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java

Modified: incubator/servicemix/branches/servicemix-3.1/common/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.1/common/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java?rev=579625&r1=579624&r2=579625&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-3.1/common/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java
(original)
+++ incubator/servicemix/branches/servicemix-3.1/common/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java
Wed Sep 26 05:01:18 2007
@@ -67,7 +67,7 @@
     private SourceTransformer sourceTransformer = new SourceTransformer();
     private boolean loadOnStartup = true;
 
-    public SyndFeed getCachedFeed() throws IllegalArgumentException, FeedException, IOException
{
+    public synchronized SyndFeed getCachedFeed() throws IllegalArgumentException, FeedException,
IOException {
         if (cachedFeed == null) {
             cachedFeed = loadOrCreateFeed();
         }
@@ -187,9 +187,11 @@
 
     protected void process(MessageExchange exchange, NormalizedMessage message) throws Exception
{
         SyndFeed feed = getCachedFeed();
-        addMessageToFeed(feed, exchange, message);
-        removeExpiredEntries(feed);
-        writeFeed(feed, exchange, message);
+        synchronized (feed) {
+            addMessageToFeed(feed, exchange, message);
+            removeExpiredEntries(feed);
+            writeFeed(feed, exchange, message);
+        }
         done(exchange);
     }
 



Mime
View raw message