You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/09/01 17:47:13 UTC

svn commit: r991575 - /activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/util/IdGenerator.cpp

Author: tabish
Date: Wed Sep  1 15:47:12 2010
New Revision: 991575

URL: http://svn.apache.org/viewvc?rev=991575&view=rev
Log:
workaround fix for the 3.2.x branch for: https://issues.apache.org/activemq/browse/AMQCPP-314

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/util/IdGenerator.cpp

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/util/IdGenerator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/util/IdGenerator.cpp?rev=991575&r1=991574&r2=991575&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/util/IdGenerator.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/util/IdGenerator.cpp Wed Sep  1 15:47:12 2010
@@ -22,6 +22,7 @@
 #include <decaf/lang/Thread.h>
 #include <decaf/net/InetAddress.h>
 #include <decaf/net/ServerSocket.h>
+#include <decaf/internal/net/Network.h>
 
 #include <apr_strings.h>
 
@@ -32,6 +33,7 @@ using namespace decaf::lang;
 using namespace decaf::net;
 using namespace decaf::util;
 using namespace decaf::util::concurrent;
+using namespace decaf::internal::net;
 
 ////////////////////////////////////////////////////////////////////////////////
 IdGenerator::StaticData::StaticData() : UNIQUE_STUB(), instanceCount(0), hostname() {
@@ -144,6 +146,11 @@ int IdGenerator::compare( const std::str
 
 ////////////////////////////////////////////////////////////////////////////////
 IdGenerator::StaticData& IdGenerator::getClassStaticData() {
-    static IdGenerator::StaticData statics;
-    return statics;
+
+    Network* netRuntime = Network::getNetworkRuntime();
+
+    synchronized( netRuntime->getRuntimeLock() ) {
+        static IdGenerator::StaticData statics;
+        return statics;
+    }
 }