activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1444450 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp: TcpTransport.cpp TcpTransport.h
Date Sat, 09 Feb 2013 22:01:16 GMT
Author: tabish
Date: Sat Feb  9 22:01:16 2013
New Revision: 1444450

URL: http://svn.apache.org/r1444450
Log:
https://issues.apache.org/jira/browse/AMQCPP-457

Better control over Transport start and stop.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp?rev=1444450&r1=1444449&r2=1444450&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp
Sat Feb  9 22:01:16 2013
@@ -56,9 +56,6 @@ namespace tcp {
 
         int connectTimeout;
 
-        AtomicBoolean closed;
-        AtomicBoolean started;
-
         std::auto_ptr<decaf::net::Socket> socket;
         std::auto_ptr<decaf::io::DataInputStream> dataInputStream;
         std::auto_ptr<decaf::io::DataOutputStream> dataOutputStream;
@@ -78,7 +75,6 @@ namespace tcp {
 
         TcpTransportImpl(const decaf::net::URI& location) :
             connectTimeout(0),
-            closed(false),
             socket(),
             dataInputStream(),
             dataOutputStream(),
@@ -116,9 +112,7 @@ TcpTransport::~TcpTransport() {
 ////////////////////////////////////////////////////////////////////////////////
 void TcpTransport::beforeNextIsStarted() {
     try {
-        if (this->impl->started.compareAndSet(false, true)) {
-            connect();
-        }
+        connect();
     }
     AMQ_CATCH_RETHROW(IOException)
     AMQ_CATCH_EXCEPTION_CONVERT(Exception, IOException)
@@ -130,10 +124,8 @@ void TcpTransport::afterNextIsStopped() 
     try {
         // The IOTransport is now stopped, so we can safely closed the socket
         // and no asynchronous exceptions should be triggered.
-        if (this->impl->started.compareAndSet(true, false)) {
-            if (impl->socket.get() != NULL) {
-                impl->socket->close();
-            }
+        if (impl->socket.get() != NULL) {
+            impl->socket->close();
         }
     }
     AMQ_CATCH_RETHROW(IOException)
@@ -144,10 +136,8 @@ void TcpTransport::afterNextIsStopped() 
 ////////////////////////////////////////////////////////////////////////////////
 void TcpTransport::doClose() {
     try {
-        if (this->impl->closed.compareAndSet(false, true)) {
-            if (impl->socket.get() != NULL) {
-                impl->socket->close();
-            }
+        if (impl->socket.get() != NULL) {
+            impl->socket->close();
         }
     }
     AMQ_CATCH_RETHROW(IOException)
@@ -275,11 +265,6 @@ void TcpTransport::configureSocket(Socke
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool TcpTransport::isClosed() const {
-    return this->impl->closed.get();
-}
-
-////////////////////////////////////////////////////////////////////////////////
 bool TcpTransport::isConnected() const {
     if (this->impl->socket.get() != NULL) {
         return this->impl->socket->isConnected();

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.h?rev=1444450&r1=1444449&r2=1444450&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.h
Sat Feb  9 22:01:16 2013
@@ -105,8 +105,6 @@ namespace tcp {
 
         virtual bool isConnected() const;
 
-        virtual bool isClosed() const;
-
     protected:
 
         virtual void beforeNextIsStarted();



Mime
View raw message