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 2012/10/04 17:21:55 UTC
svn commit: r1394114 - in
/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main:
activemq/core/ activemq/transport/inactivity/ activemq/transport/tcp/
decaf/io/
Author: tabish
Date: Thu Oct 4 15:21:55 2012
New Revision: 1394114
URL: http://svn.apache.org/viewvc?rev=1394114&view=rev
Log:
Clean up some old destructor code to make sure all close and deletes are done correctly.
Modified:
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp Thu Oct 4 15:21:55 2012
@@ -85,7 +85,6 @@ ActiveMQProducer::~ActiveMQProducer() th
try {
close();
}
- AMQ_CATCH_NOTHROW( ActiveMQException )
AMQ_CATCHALL_NOTHROW( )
}
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp Thu Oct 4 15:21:55 2012
@@ -248,6 +248,10 @@ InactivityMonitor::InactivityMonitor( co
InactivityMonitor::~InactivityMonitor() {
try{
this->stopMonitorThreads();
+ }
+ AMQ_CATCHALL_NOTHROW()
+
+ try{
delete this->members;
}
AMQ_CATCHALL_NOTHROW()
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/tcp/TcpTransport.cpp Thu Oct 4 15:21:55 2012
@@ -53,8 +53,6 @@ TcpTransport::~TcpTransport() {
try {
close();
}
- AMQ_CATCH_NOTHROW( ActiveMQException )
- AMQ_CATCH_NOTHROW( Exception )
AMQ_CATCHALL_NOTHROW()
}
@@ -79,8 +77,8 @@ void TcpTransport::close() {
}
////////////////////////////////////////////////////////////////////////////////
-void TcpTransport::connect( const decaf::net::URI& uri,
- const decaf::util::Properties& properties ) {
+void TcpTransport::connect(const decaf::net::URI& uri,
+ const decaf::util::Properties& properties) {
try {
@@ -119,22 +117,26 @@ void TcpTransport::connect( const decaf:
int outputBufferSize = Integer::parseInt(
properties.getProperty( "outputBufferSize", "8192" ) );
- Pointer<InputStream> inputStream(socket->getInputStream());
- Pointer<OutputStream> outputStream(socket->getOutputStream());
+ // We don't own these ever, socket object owns.
+ InputStream* socketIStream = socket->getInputStream();
+ OutputStream* sokcetOStream = socket->getOutputStream();
+
+ Pointer<InputStream> inputStream;
+ Pointer<OutputStream> outputStream;
// If tcp tracing was enabled, wrap the iostreams with logging streams
if (properties.getProperty("transport.tcpTracingEnabled", "false") == "true") {
// Wrap with logging stream, we don't own the wrapped streams
- inputStream.reset(new LoggingInputStream(inputStream.release()));
- outputStream.reset(new LoggingOutputStream(outputStream.release()));
+ inputStream.reset(new LoggingInputStream(socketIStream));
+ outputStream.reset(new LoggingOutputStream(sokcetOStream));
// Now wrap with the Buffered streams, we own the source streams
inputStream.reset(new BufferedInputStream(inputStream.release(), inputBufferSize, true));
outputStream.reset(new BufferedOutputStream(outputStream.release(), outputBufferSize, true));
} else {
// Wrap with the Buffered streams, we don't own the source streams
- inputStream.reset(new BufferedInputStream(inputStream.release(), inputBufferSize));
- outputStream.reset(new BufferedOutputStream(outputStream.release(), outputBufferSize));
+ inputStream.reset(new BufferedInputStream(socketIStream, inputBufferSize));
+ outputStream.reset(new BufferedOutputStream(sokcetOStream, outputBufferSize));
}
// Now wrap the Buffered Streams with DataInput based streams. We own
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp Thu Oct 4 15:21:55 2012
@@ -53,10 +53,10 @@ BufferedInputStream::BufferedInputStream
BufferedInputStream::~BufferedInputStream() {
try{
this->close();
- delete [] this->buff;
}
- DECAF_CATCH_NOTHROW( IOException )
DECAF_CATCHALL_NOTHROW()
+
+ delete [] this->buff;
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp Thu Oct 4 15:21:55 2012
@@ -48,17 +48,16 @@ BufferedOutputStream::BufferedOutputStre
////////////////////////////////////////////////////////////////////////////////
BufferedOutputStream::~BufferedOutputStream() {
- try{
+ try {
this->close();
-
- // Destroy the buffer.
- if( buffer != NULL ){
- delete [] buffer;
- buffer = NULL;
- }
}
- DECAF_CATCH_NOTHROW( IOException )
DECAF_CATCHALL_NOTHROW()
+
+ // Destroy the buffer.
+ if( buffer != NULL ){
+ delete [] buffer;
+ buffer = NULL;
+ }
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp Thu Oct 4 15:21:55 2012
@@ -49,7 +49,6 @@ ByteArrayOutputStream::~ByteArrayOutputS
try{
delete [] buffer;
}
- DECAF_CATCH_NOTHROW( Exception )
DECAF_CATCHALL_NOTHROW()
}
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp Thu Oct 4 15:21:55 2012
@@ -35,13 +35,14 @@ FilterInputStream::~FilterInputStream()
try {
this->close();
+ }
+ DECAF_CATCHALL_NOTHROW( )
+ try {
if( own ) {
delete inputStream;
}
- inputStream = NULL;
}
- DECAF_CATCH_NOTHROW( IOException )
DECAF_CATCHALL_NOTHROW( )
}
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp Thu Oct 4 15:21:55 2012
@@ -36,13 +36,14 @@ FilterOutputStream::FilterOutputStream(
FilterOutputStream::~FilterOutputStream() {
try {
this->close();
+ }
+ DECAF_CATCHALL_NOTHROW( )
+ try {
if( own ) {
delete outputStream;
}
- outputStream = NULL;
}
- DECAF_CATCH_NOTHROW( IOException )
DECAF_CATCHALL_NOTHROW( )
}
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp Thu Oct 4 15:21:55 2012
@@ -39,17 +39,16 @@ OutputStreamWriter::OutputStreamWriter(
////////////////////////////////////////////////////////////////////////////////
OutputStreamWriter::~OutputStreamWriter() {
- try{
-
+ try {
this->close();
+ }
+ DECAF_CATCHALL_NOTHROW()
+ try {
if( this->own ) {
delete this->stream;
}
-
- this->stream = NULL;
}
- DECAF_CATCH_NOTHROW( Exception )
DECAF_CATCHALL_NOTHROW()
}
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp?rev=1394114&r1=1394113&r2=1394114&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp Thu Oct 4 15:21:55 2012
@@ -44,13 +44,12 @@ PushbackInputStream::PushbackInputStream
////////////////////////////////////////////////////////////////////////////////
PushbackInputStream::~PushbackInputStream() {
- try{
-
+ try {
close();
- delete [] this->buffer;
}
- DECAF_CATCH_NOTHROW( Exception )
DECAF_CATCHALL_NOTHROW()
+
+ delete [] this->buffer;
}
////////////////////////////////////////////////////////////////////////////////