Author: tabish Date: Mon Aug 31 19:24:08 2009 New Revision: 809703 URL: http://svn.apache.org/viewvc?rev=809703&view=rev Log: (empty) Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h (with props) activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/SynchronousQueueTest.cpp (with props) activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/SynchronousQueueTest.h (with props) Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/Transport.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.h 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 activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Closeable.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CountDownLatch.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/ConsoleHandler.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/StreamHandler.h activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.h activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.h activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.h activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/FilterInputStreamTest.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/FilterInputStreamTest.h Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Mon Aug 31 19:24:08 2009 @@ -1212,6 +1212,7 @@ decaf/util/TimerTask.h \ decaf/util/UUID.h \ decaf/util/comparators/Less.h \ + decaf/util/concurrent/BlockingQueue.h \ decaf/util/concurrent/BrokenBarrierException.h \ decaf/util/concurrent/Callable.h \ decaf/util/concurrent/CancellationException.h \ @@ -1229,7 +1230,9 @@ decaf/util/concurrent/PooledThread.h \ decaf/util/concurrent/PooledThreadListener.h \ decaf/util/concurrent/RejectedExecutionException.h \ + decaf/util/concurrent/RejectedExecutionHandler.h \ decaf/util/concurrent/Synchronizable.h \ + decaf/util/concurrent/SynchronousQueue.h \ decaf/util/concurrent/TaskListener.h \ decaf/util/concurrent/ThreadFactory.h \ decaf/util/concurrent/ThreadPool.h \ Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp Mon Aug 31 19:24:08 2009 @@ -137,13 +137,13 @@ } //////////////////////////////////////////////////////////////////////////////// -void IOTransport::start() throw( cms::CMSException ){ +void IOTransport::start() throw( decaf::io::IOException ){ try{ // Can't restart a closed transport. if( closed ){ - throw ActiveMQException( + throw IOException( __FILE__, __LINE__, "IOTransport::start() - transport is already closed - cannot restart" ); } @@ -155,7 +155,7 @@ // Make sure all variables that we need have been set. if( inputStream == NULL || outputStream == NULL || wireFormat.get() == NULL ){ - throw ActiveMQException( + throw IOException( __FILE__, __LINE__, "IOTransport::start() - " "IO streams and wireFormat instances must be set before calling start" ); @@ -165,13 +165,23 @@ thread.reset( new Thread( this ) ); thread->start(); } - AMQ_CATCH_RETHROW( ActiveMQException ) - AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException ) - AMQ_CATCHALL_THROW( ActiveMQException ) + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) } //////////////////////////////////////////////////////////////////////////////// -void IOTransport::close() throw( cms::CMSException ){ +void IOTransport::stop() throw( decaf::io::IOException ){ + + try{ + } + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) +} + +//////////////////////////////////////////////////////////////////////////////// +void IOTransport::close() throw( decaf::io::IOException ){ try{ @@ -207,9 +217,9 @@ // Clear the WireFormat so we can't use it anymore this->wireFormat.reset( NULL ); } - AMQ_CATCH_RETHROW( ActiveMQException ) - AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException ) - AMQ_CATCHALL_THROW( ActiveMQException ) + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h Mon Aug 31 19:24:08 2009 @@ -202,15 +202,23 @@ * @throws CMSException if an error occurs or if this transport * has already been closed. */ - virtual void start() throw( cms::CMSException ); + virtual void start() throw( decaf::io::IOException ); + + /** + * Stops the Transport, terminating any threads and stopping all read + * and write operations. + * + * @throw IOException if an error occurs while stopping the Transport. + */ + virtual void stop() throw( decaf::io::IOException ); /** * Stops the polling thread and closes the streams. This can * be called explicitly, but is also called in the destructor. Once * this object has been closed, it cannot be restarted. - * @throws CMSException if errors occur. + * @throws IOException if errors occur. */ - virtual void close() throw( cms::CMSException ); + virtual void close() throw( decaf::io::IOException ); /** * Runs the polling thread. Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/Transport.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/Transport.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/Transport.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/Transport.h Mon Aug 31 19:24:08 2009 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -54,13 +55,27 @@ * object when created so that they can turn the built in Commands to / * from the required wire format encoding. */ - class AMQCPP_API Transport : public cms::Startable, - public cms::Closeable { + class AMQCPP_API Transport : public decaf::io::Closeable { public: virtual ~Transport() {} /** + * Starts the Transport, the send methods of a Transport will throw an exception + * if used before the Transport is started. + * + * @throw IOException if and error occurs while starting the Transport. + */ + virtual void start() throw( decaf::io::IOException ) = 0; + + /** + * Stops the Transport. + * + * @throw IOException if an error occurs while stopping the transport. + */ + virtual void stop() throw( decaf::io::IOException ) = 0; + + /** * Sends a one-way command. Does not wait for any response from the * broker. * @param command the command to be sent. Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.cpp Mon Aug 31 19:24:08 2009 @@ -79,11 +79,10 @@ } //////////////////////////////////////////////////////////////////////////////// -void TransportFilter::start() throw( cms::CMSException ) { +void TransportFilter::start() throw( decaf::io::IOException ) { if( listener == NULL ){ - throw exceptions::ActiveMQException( __FILE__, __LINE__, - "exceptionListener is invalid" ); + throw decaf::io::IOException( __FILE__, __LINE__, "exceptionListener is invalid" ); } // Start the delegate transport object. @@ -91,7 +90,12 @@ } //////////////////////////////////////////////////////////////////////////////// -void TransportFilter::close() throw( cms::CMSException ) { +void TransportFilter::stop() throw( decaf::io::IOException ) { + next->stop(); +} + +//////////////////////////////////////////////////////////////////////////////// +void TransportFilter::close() throw( decaf::io::IOException ) { if( next != NULL ) { next->close(); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.h Mon Aug 31 19:24:08 2009 @@ -171,18 +171,26 @@ * has been closed, throws an exception. Before calling start, * the caller must set the IO streams and the reader and writer * objects. - * @throws CMSException if an error occurs or if this transport + * @throws IOException if an error occurs or if this transport * has already been closed. */ - virtual void start() throw( cms::CMSException ); + virtual void start() throw( decaf::io::IOException ); + + /** + * Stops the Transport. + * + * @throws IOException if an error occurs while stopping the Transport. + */ + virtual void stop() throw( decaf::io::IOException ); /** * Stops the polling thread and closes the streams. This can * be called explicitly, but is also called in the destructor. Once * this object has been closed, it cannot be restarted. - * @throws CMSException if errors occur. + * + * @throws IOException if an error occurs while closing the Transport. */ - virtual void close() throw( cms::CMSException ); + virtual void close() throw( decaf::io::IOException ); /** * Narrows down a Chain of Transports to a specific Transport to allow a Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp Mon Aug 31 19:24:08 2009 @@ -203,7 +203,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void ResponseCorrelator::start() throw( cms::CMSException ) { +void ResponseCorrelator::start() throw( decaf::io::IOException ) { try{ @@ -215,13 +215,11 @@ } if( listener == NULL ){ - throw exceptions::ActiveMQException( __FILE__, __LINE__, - "exceptionListener is invalid" ); + throw IOException( __FILE__, __LINE__, "exceptionListener is invalid" ); } if( next == NULL ){ - throw exceptions::ActiveMQException( __FILE__, __LINE__, - "next transport is NULL" ); + throw IOException( __FILE__, __LINE__, "next transport is NULL" ); } // Start the delegate transport object. @@ -230,13 +228,13 @@ // Mark it as open. closed = false; } - AMQ_CATCH_RETHROW( ActiveMQException ) - AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException ) - AMQ_CATCHALL_THROW( ActiveMQException ) + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) } //////////////////////////////////////////////////////////////////////////////// -void ResponseCorrelator::close() throw( cms::CMSException ){ +void ResponseCorrelator::close() throw( decaf::io::IOException ){ try{ @@ -254,9 +252,9 @@ closed = true; } - AMQ_CATCH_RETHROW( ActiveMQException ) - AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException ) - AMQ_CATCHALL_THROW( ActiveMQException ) + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.h Mon Aug 31 19:24:08 2009 @@ -126,18 +126,18 @@ * has been closed, throws an exception. Before calling start, * the caller must set the IO streams and the reader and writer * objects. - * @throws CMSException if an error occurs or if this transport + * @throws IOException if an error occurs or if this transport * has already been closed. */ - virtual void start() throw( cms::CMSException ); + virtual void start() throw( decaf::io::IOException ); /** * Stops the polling thread and closes the streams. This can * be called explicitly, but is also called in the destructor. Once * this object has been closed, it cannot be restarted. - * @throws CMSException if errors occur. + * @throws IOException if errors occur. */ - virtual void close() throw( cms::CMSException ); + virtual void close() throw( decaf::io::IOException ); /** * Event handler for an exception from a command transport. Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp Mon Aug 31 19:24:08 2009 @@ -318,7 +318,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void FailoverTransport::start() throw( cms::CMSException ) { +void FailoverTransport::start() throw( IOException ) { try{ @@ -340,44 +340,60 @@ } } } - AMQ_CATCH_RETHROW( ActiveMQException ) - AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException ) - AMQ_CATCHALL_THROW( ActiveMQException ) + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) } //////////////////////////////////////////////////////////////////////////////// -void FailoverTransport::close() throw( cms::CMSException ) { +void FailoverTransport::stop() throw( IOException ) { - Pointer transportToStop; + try{ + } + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) +} - synchronized( &reconnectMutex ) { - if (!started) { - return; - } +//////////////////////////////////////////////////////////////////////////////// +void FailoverTransport::close() throw( IOException ) { - started = false; - closed = true; - connected = false; + try{ - backups->setEnabled( false ); - requestMap.clear(); + Pointer transportToStop; - if( connectedTransport != NULL ) { - transportToStop.swap( connectedTransport ); - } + synchronized( &reconnectMutex ) { + if (!started) { + return; + } - reconnectMutex.notifyAll(); - } + started = false; + closed = true; + connected = false; - synchronized( &sleepMutex ) { - sleepMutex.notifyAll(); - } + backups->setEnabled( false ); + requestMap.clear(); + + if( connectedTransport != NULL ) { + transportToStop.swap( connectedTransport ); + } + + reconnectMutex.notifyAll(); + } + + synchronized( &sleepMutex ) { + sleepMutex.notifyAll(); + } - taskRunner->shutdown( 2000 ); + taskRunner->shutdown( 2000 ); - if( transportToStop != NULL ) { - transportToStop->close(); + if( transportToStop != NULL ) { + transportToStop->close(); + } } + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h Mon Aug 31 19:24:08 2009 @@ -138,18 +138,25 @@ * has been closed, throws an exception. Before calling start, * the caller must set the IO streams and the reader and writer * objects. - * @throws CMSException if an error occurs or if this transport + * @throws IOException if an error occurs or if this transport * has already been closed. */ - virtual void start() throw( cms::CMSException ); + virtual void start() throw( decaf::io::IOException ); + + /** + * Stop the Transport. + * + * @throws IOException if an error occurs while stopping the Transport. + */ + virtual void stop() throw( decaf::io::IOException ); /** * Stops the polling thread and closes the streams. This can * be called explicitly, but is also called in the destructor. Once * this object has been closed, it cannot be restarted. - * @throws CMSException if errors occur. + * @throws IOException if errors occur. */ - virtual void close() throw( cms::CMSException ); + virtual void close() throw( decaf::io::IOException ); /** * Sends a one-way command. Does not wait for any response from the Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp Mon Aug 31 19:24:08 2009 @@ -122,12 +122,14 @@ } //////////////////////////////////////////////////////////////////////////////// -void InactivityMonitor::close() throw( cms::CMSException ) { +void InactivityMonitor::close() throw( decaf::io::IOException ) { try{ stopMonitorThreads(); TransportFilter::close(); } - AMQ_CATCH_ALL_THROW_CMSEXCEPTION() + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.h Mon Aug 31 19:24:08 2009 @@ -95,7 +95,7 @@ virtual ~InactivityMonitor(); - virtual void close() throw( cms::CMSException ); + virtual void close() throw( decaf::io::IOException ); virtual void onException( const decaf::lang::Exception& ex ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.cpp Mon Aug 31 19:24:08 2009 @@ -48,6 +48,9 @@ this->failOnReceiveMessage = false; this->numReceivedMessageBeforeFail = 0; this->numReceivedMessages = 0; + this->failOnStart = false; + this->failOnStop = false; + this->failOnClose = false; // Configure the Internal Listener this is the Fake Broker. this->internalListener.setTransport( this ); @@ -140,3 +143,27 @@ AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) AMQ_CATCHALL_THROW( IOException ) } + +//////////////////////////////////////////////////////////////////////////////// +void MockTransport::start() throw( decaf::io::IOException ) { + + if( this->failOnStart ) { + throw IOException( __FILE__, __LINE__, "Failed to Start MockTransport." ); + } +} + +//////////////////////////////////////////////////////////////////////////////// +void MockTransport::stop() throw( decaf::io::IOException ) { + + if( this->failOnStop ) { + throw IOException( __FILE__, __LINE__, "Failed to Stop MockTransport." ); + } +} + +//////////////////////////////////////////////////////////////////////////////// +void MockTransport::close() throw( decaf::io::IOException ) { + + if( this->failOnClose ) { + throw IOException( __FILE__, __LINE__, "Failed to Close MockTransport." ); + } +} Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.h Mon Aug 31 19:24:08 2009 @@ -77,6 +77,10 @@ int numReceivedMessageBeforeFail; int numReceivedMessages; + bool failOnStart; + bool failOnStop; + bool failOnClose; + public: MockTransport( const Pointer& wireFormat, @@ -168,9 +172,11 @@ } } - // No Impl needed for this Transport. - virtual void start() throw (cms::CMSException){} - virtual void close() throw (cms::CMSException){} + virtual void start() throw( decaf::io::IOException ); + + virtual void stop() throw( decaf::io::IOException ); + + virtual void close() throw( decaf::io::IOException ); /** * Narrows down a Chain of Transports to a specific Transport to allow a @@ -282,6 +288,30 @@ this->numReceivedMessages = value; } + bool isFailOnStart() const { + return this->failOnReceiveMessage; + } + + void setFailOnStart( bool value ) { + this->failOnReceiveMessage = value; + } + + bool isFailOnStop() const { + return this->failOnStop; + } + + void setFailOnStop( bool value ) { + this->failOnStop = value; + } + + bool isFailOnClose() const { + return this->failOnClose; + } + + void setFailOnClose( bool value ) { + this->failOnClose = value; + } + }; }}} 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=809703&r1=809702&r2=809703&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 Mon Aug 31 19:24:08 2009 @@ -69,7 +69,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void TcpTransport::close() throw( cms::CMSException ) { +void TcpTransport::close() throw( decaf::io::IOException ) { try { @@ -83,9 +83,9 @@ // Invoke the paren't close first. TransportFilter::close(); } - AMQ_CATCH_RETHROW( ActiveMQException ) - AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException ) - AMQ_CATCHALL_THROW( ActiveMQException ) + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) } //////////////////////////////////////////////////////////////////////////////// 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=809703&r1=809702&r2=809703&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 Mon Aug 31 19:24:08 2009 @@ -91,9 +91,9 @@ /** * Delegates to the superclass and then closes the socket. - * @throws CMSException if errors occur. + * @throws IOException if errors occur. */ - virtual void close() throw( cms::CMSException ); + virtual void close() throw( decaf::io::IOException ); /** * Is this Transport fault tolerant, meaning that it will reconnect to Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp Mon Aug 31 19:24:08 2009 @@ -31,6 +31,7 @@ using namespace activemq::commands; using namespace decaf::util::concurrent; using namespace decaf::io; +using namespace decaf::lang; using namespace decaf::lang::exceptions; //////////////////////////////////////////////////////////////////////////////// @@ -183,7 +184,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void OpenWireFormatNegotiator::start() throw( cms::CMSException ){ +void OpenWireFormatNegotiator::start() throw( IOException ){ /** * We're already started. @@ -193,24 +194,21 @@ } if( listener == NULL ){ - throw exceptions::ActiveMQException( + throw IOException( __FILE__, __LINE__, - "OpenWireFormatNegotiator::start - " - "TransportListener is invalid" ); + "OpenWireFormatNegotiator::start - TransportListener is invalid" ); } if( next == NULL ){ - throw exceptions::ActiveMQException( + throw IOException( __FILE__, __LINE__, - "OpenWireFormatNegotiator::start - " - "next transport is NULL" ); + "OpenWireFormatNegotiator::start - next transport is NULL" ); } if( openWireFormat == NULL ){ - throw exceptions::ActiveMQException( + throw IOException( __FILE__, __LINE__, - "OpenWireFormatNegotiator::start - " - "openWireFormat is NULL" ); + "OpenWireFormatNegotiator::start - openWireFormat is NULL" ); } // Start the delegate transport object. @@ -236,12 +234,12 @@ // Mark the latch wireInfoSentDownLatch.countDown(); - } catch( ActiveMQException& ex ) { + } catch( decaf::lang::Exception& ex ) { // Mark the latch wireInfoSentDownLatch.countDown(); ex.setMark( __FILE__, __LINE__ ); - throw ex; + throw; } } @@ -250,12 +248,18 @@ } //////////////////////////////////////////////////////////////////////////////// -void OpenWireFormatNegotiator::close() throw( cms::CMSException ){ +void OpenWireFormatNegotiator::close() throw( IOException ){ - if( !closed && next != NULL ){ - next->close(); - } + try{ + + if( !closed && next != NULL ){ + next->close(); + } - closed = true; + closed = true; + } + AMQ_CATCH_RETHROW( IOException ) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + AMQ_CATCHALL_THROW( IOException ) } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h Mon Aug 31 19:24:08 2009 @@ -140,18 +140,18 @@ * has been closed, throws an exception. Before calling start, * the caller must set the IO streams and the reader and writer * objects. - * @throws CMSException if an error occurs or if this transport + * @throws IOException if an error occurs or if this transport * has already been closed. */ - virtual void start() throw( cms::CMSException ); + virtual void start() throw( decaf::io::IOException ); /** * Stops the polling thread and closes the streams. This can * be called explicitly, but is also called in the destructor. Once * this object has been closed, it cannot be restarted. - * @throws CMSException if errors occur. + * @throws IOException if errors occur. */ - virtual void close() throw( cms::CMSException ); + virtual void close() throw( decaf::io::IOException ); }; Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardErrorOutputStream.h Mon Aug 31 19:24:08 2009 @@ -89,9 +89,9 @@ /** * Invokes close on the target output stream. - * throws CMSException if an error occurs + * throws IOException if an error occurs */ - virtual void close() throw( decaf::lang::Exception ){ + virtual void close() throw( decaf::io::IOException ){ this->flush(); } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h Mon Aug 31 19:24:08 2009 @@ -61,8 +61,8 @@ * * @return The number of bytes read. * - * @throws decaf::io::IOException thrown if an error occurs. - * @throws decaf::lang::exceptions::NullPointerException if buffer is null. + * @throws IOException thrown if an error occurs. + * @throws NullPointerException if buffer is null. */ virtual int read( unsigned char* buffer, std::size_t offset, @@ -71,9 +71,9 @@ /** * Closes the target input stream. - * @throws decaf::io::IOException thrown if an error occurs. + * @throws IOException thrown if an error occurs. */ - virtual void close() throw( lang::Exception ) {} + virtual void close() throw( decaf::io::IOException ) {} /** * Skips over and discards n bytes of data from this input stream. The @@ -90,8 +90,8 @@ * @param num - the number of bytes to skip * @returns total bytes skipped * - * @throws decaf::io::IOException if an error occurs - * @throws decaf::lang::exceptions::UnsupportedOperationException + * @throws IOException if an error occurs + * @throws UnsupportedOperationException * If skip is not supported. */ virtual std::size_t skip( std::size_t num ) Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardOutputStream.h Mon Aug 31 19:24:08 2009 @@ -60,7 +60,7 @@ * @param buffer The array of bytes to write. * @param offset, the position to start writing in buffer. * @param len The number of bytes from the buffer to be written. - * @throws decaf::io::IOException thrown if an error occurs. + * @throws IOException thrown if an error occurs. * @throws NullPointerException if buffer is null. */ virtual void write( const unsigned char* buffer, @@ -70,15 +70,15 @@ /** * Invokes flush on the target output stream. - * throws decaf::io::IOException if an error occurs + * throws IOException if an error occurs */ virtual void flush() throw ( decaf::io::IOException ); /** * Invokes close on the target output stream. - * throws CMSException if an error occurs + * throws IOException if an error occurs */ - virtual void close() throw( decaf::lang::Exception ){ + virtual void close() throw( decaf::io::IOException ){ this->flush(); } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp Mon Aug 31 19:24:08 2009 @@ -65,7 +65,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void BlockingByteArrayInputStream::close() throw ( lang::Exception ){ +void BlockingByteArrayInputStream::close() throw ( io::IOException ){ synchronized( this ){ Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h Mon Aug 31 19:24:08 2009 @@ -123,7 +123,7 @@ * Closes the target input stream. * @throws IOException if an error occurs. */ - virtual void close() throw ( lang::Exception ); + virtual void close() throw ( io::IOException ); /** * Skips over and discards n bytes of data from this input stream. The Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h Mon Aug 31 19:24:08 2009 @@ -219,7 +219,7 @@ * Populates the buffer with as much data as possible * from the target input stream. * @returns total bytes read, or -1 if EOF. - * @throws CMSException + * @throws IOException */ int bufferData() throw ( IOException ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.cpp Mon Aug 31 19:24:08 2009 @@ -77,7 +77,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void BufferedOutputStream::close() throw( lang::Exception ){ +void BufferedOutputStream::close() throw( io::IOException ){ // let parent close the inputStream FilterOutputStream::close(); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedOutputStream.h Mon Aug 31 19:24:08 2009 @@ -117,9 +117,9 @@ /** * Invokes close on the target output stream. - * @throws CMSException thrown if an error occurs. + * @throws IOException thrown if an error occurs. */ - void close() throw( lang::Exception ); + void close() throw( io::IOException ); private: Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h Mon Aug 31 19:24:08 2009 @@ -143,7 +143,7 @@ * Closes the target input stream. * @throws IOException thrown if an error occurs. */ - virtual void close() throw( lang::Exception ){ /* do nothing */ } + virtual void close() throw( io::IOException ){ /* do nothing */ } /** * Skips over and discards n bytes of data from this input stream. The Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h Mon Aug 31 19:24:08 2009 @@ -130,9 +130,9 @@ /** * Invokes close on the target output stream. - * @throws CMSException + * @throws IOException */ - void close() throw( lang::Exception ){ /* do nothing */ } + void close() throw( io::IOException ){ /* do nothing */ } /** * Converts the bytes in the buffer into a standard C++ string Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Closeable.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Closeable.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Closeable.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Closeable.h Mon Aug 31 19:24:08 2009 @@ -18,7 +18,8 @@ #ifndef _DECAF_IO_CLOSEABLE_H_ #define _DECAF_IO_CLOSEABLE_H_ -#include +#include +#include namespace decaf{ namespace io{ @@ -26,8 +27,7 @@ /** * Interface for a class that implements the close method. */ - class DECAF_API Closeable{ - + class DECAF_API Closeable { public: virtual ~Closeable(){} @@ -35,9 +35,10 @@ /** * Closes this object and deallocates the appropriate resources. * The object is generally no longer usable after calling close. - * @throws CMSException + * + * @throws IOException if an error occurs while closing. */ - virtual void close() throw( lang::Exception ) = 0; + virtual void close() throw( io::IOException ) = 0; }; Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h Mon Aug 31 19:24:08 2009 @@ -160,7 +160,7 @@ * method of the underlying stream * @throws Exception */ - virtual void close() throw ( lang::Exception ) { + virtual void close() throw ( io::IOException ) { try { if( !closed && inputStream != NULL ) { inputStream->close(); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h Mon Aug 31 19:24:08 2009 @@ -198,7 +198,7 @@ * stream, it then destroys the output stream if it is the owner. * @throws Exception */ - virtual void close() throw ( lang::Exception ) { + virtual void close() throw ( io::IOException ) { try { if( !closed && outputStream != NULL ) { outputStream->flush(); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.cpp Mon Aug 31 19:24:08 2009 @@ -112,7 +112,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void BufferedSocket::close() throw( lang::Exception ) { +void BufferedSocket::close() throw( decaf::io::IOException ) { try { @@ -137,7 +137,7 @@ } catch( lang::Exception& ex ){ /* Absorb */ } } } - DECAF_CATCH_RETHROW( SocketException ) - DECAF_CATCH_EXCEPTION_CONVERT( Exception, SocketException ) - DECAF_CATCHALL_THROW( SocketException ) + DECAF_CATCH_RETHROW( IOException ) + DECAF_CATCH_EXCEPTION_CONVERT( Exception, IOException ) + DECAF_CATCHALL_THROW( IOException ) } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/BufferedSocket.h Mon Aug 31 19:24:08 2009 @@ -30,8 +30,7 @@ * object and provides Buffered input and Output Streams to improce * the efficiency of the reads and writes. */ - class DECAF_API BufferedSocket : public Socket - { + class DECAF_API BufferedSocket : public Socket { private: // Socket that this class wraps to provide buffering @@ -79,9 +78,9 @@ /** * Closes this object and deallocates the appropriate resources. - * @throws CMSException + * @throws IOException */ - virtual void close() throw( lang::Exception ); + virtual void close() throw( decaf::io::IOException ); /** * Indicates whether or not this socket is connected to a destination. Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp Mon Aug 31 19:24:08 2009 @@ -64,7 +64,7 @@ SocketInputStream::~SocketInputStream(){} //////////////////////////////////////////////////////////////////////////////// -void SocketInputStream::close() throw( lang::Exception ){ +void SocketInputStream::close() throw( decaf::io::IOException ){ this->closed = true; } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h Mon Aug 31 19:24:08 2009 @@ -86,9 +86,9 @@ /** * Close - does nothing. It is the responsibility of the owner * of the socket object to close it. - * @throws CMSException + * @throws IOException */ - virtual void close() throw( lang::Exception ); + virtual void close() throw( decaf::io::IOException ); /** * Not supported. Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.cpp Mon Aug 31 19:24:08 2009 @@ -39,7 +39,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void SocketOutputStream::close() throw( lang::Exception ) { +void SocketOutputStream::close() throw( decaf::io::IOException ) { this->closed = true; } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketOutputStream.h Mon Aug 31 19:24:08 2009 @@ -84,9 +84,9 @@ /** * Close - does nothing. It is the responsibility of the owner * of the socket object to close it. - * @throws CMSException + * @throws IOException */ - virtual void close() throw( lang::Exception ); + virtual void close() throw( decaf::io::IOException ); public: Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.cpp Mon Aug 31 19:24:08 2009 @@ -141,7 +141,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void TcpSocket::close() throw( lang::Exception ) { +void TcpSocket::close() throw( decaf::io::IOException ) { try{ // Destroy the input stream. @@ -162,8 +162,9 @@ socketHandle = INVALID_SOCKET_HANDLE; } } - DECAF_CATCH_RETHROW( lang::Exception ) - DECAF_CATCHALL_THROW( lang::Exception ) + DECAF_CATCH_RETHROW( decaf::io::IOException ) + DECAF_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::IOException ) + DECAF_CATCHALL_THROW( decaf::io::IOException ) } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/TcpSocket.h Mon Aug 31 19:24:08 2009 @@ -218,9 +218,9 @@ /** * Closes this object and deallocates the appropriate resources. - * @throws Exception + * @throws IOException */ - virtual void close() throw( lang::Exception ); + virtual void close() throw( decaf::io::IOException ); public: Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h Mon Aug 31 19:24:08 2009 @@ -251,7 +251,9 @@ this->_size = 0; } - virtual bool offer( const E& value ) throw( decaf::lang::exceptions::NullPointerException ) { + virtual bool offer( const E& value ) + throw( decaf::lang::exceptions::NullPointerException, + decaf::lang::exceptions::IllegalArgumentException ) { // TODO - Check for Null and throw exception Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.h Mon Aug 31 19:24:08 2009 @@ -70,8 +70,12 @@ * * @throw NullPointerException if the Queue implementation does not allow Null values to * be inserted into the Queue. + * @throws IllegalArgumentException if some property of the specified + * element prevents it from being added to this queue */ - virtual bool offer( const E& value ) throw( decaf::lang::exceptions::NullPointerException ) = 0; + virtual bool offer( const E& value ) + throw( decaf::lang::exceptions::NullPointerException, + decaf::lang::exceptions::IllegalArgumentException ) = 0; /** * Gets and removes the element in the head of the queue. If the operation succeeds the Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.h Mon Aug 31 19:24:08 2009 @@ -30,11 +30,11 @@ * the queue to become non-empty when retrieving an element, and wait for space * to become available in the queue when storing an element. * - *

BlockingQueue methods come in three forms, with different ways of + *

BlockingQueue methods come in four forms, with different ways of * handling operations that cannot be satisfied immediately, but may be satisfied * at some point in the future: * one throws an exception, the second returns a special value (either - * null or false, depending on the operation), the third + * true or false, depending on the operation), the third * blocks the current thread indefinitely until the operation can succeed, * and the fourth blocks for only a given maximum time limit before giving * up. These methods are summarized in the following table: @@ -71,11 +71,10 @@ * * * - *

A BlockingQueue may be capacity bounded. At any given time it may - * have a remainingCapacity beyond which no additional elements can - * be put without blocking. A BlockingQueue without any - * intrinsic capacity constraints always reports a remaining capacity of - * Integer::MAX_VALUE. + *

A BlockingQueue may be capacity bounded. At any given time it may have + * a remainingCapacity beyond which no additional elements can be put + * without blocking. A BlockingQueue without any intrinsic capacity + * constraints always reports a remaining capacity of Integer::MAX_VALUE. * *

BlockingQueue implementations are designed to be used primarily for * producer-consumer queues, but additionally support {@link decaf.util.Collection} @@ -167,24 +166,22 @@ } /** - * Inserts the specified element into this queue if it is possible to do - * so immediately without violating capacity restrictions, returning - * true upon success and throwing an - * IllegalStateException if no space is currently available. - * When using a capacity-restricted queue, it is generally preferable to - * use {@link #offer(Object) offer}. + * Inserts the specified element into this queue if it is possible to do so immediately + * without violating capacity restrictions, returning true upon success and + * throwing an IllegalStateException if no space is currently available. + * When using a capacity-restricted queue, it is generally preferable to use + * {@link #offer(Object) offer}. * * @param e the element to add * @return true (as specified by {@link Collection#add}) * @throws IllegalStateException if the element cannot be added at this * time due to capacity restrictions - * @throws ClassCastException if the class of the specified element - * prevents it from being added to this queue - * @throws NullPointerException if the specified element is null * @throws IllegalArgumentException if some property of the specified * element prevents it from being added to this queue */ - virtual bool add(E e); + virtual bool add( const E& e ) + throw( lang::exceptions::IllegalStateException, + lang::exceptions::IllegalArgumentException ); /** * Inserts the specified element into this queue if it is possible to do @@ -197,31 +194,32 @@ * @param e the element to add * @return true if the element was added to this queue, else * false - * @throws ClassCastException if the class of the specified element - * prevents it from being added to this queue * @throws NullPointerException if the specified element is null * @throws IllegalArgumentException if some property of the specified * element prevents it from being added to this queue */ - virtual bool offer(E e); + virtual bool offer( const E& value ) + throw( decaf::lang::exceptions::NullPointerException, + decaf::lang::exceptions::IllegalArgumentException ) = 0; /** - * Inserts the specified element into this queue, waiting if necessary - * for space to become available. + * Inserts the specified element into this queue, waiting if necessary for space + * to become available. * - * @param e the element to add + * @param value the element to add * @throws InterruptedException if interrupted while waiting - * @throws ClassCastException if the class of the specified element - * prevents it from being added to this queue * @throws NullPointerException if the specified element is null * @throws IllegalArgumentException if some property of the specified * element prevents it from being added to this queue */ - virtual void put(E e) throws InterruptedException; + virtual void put( const E& value ) + throw( decaf::lang::exceptions::InterruptedException, + decaf::lang::exceptions::NullPointerException, + decaf::lang::exceptions::IllegalArgumentException ) = 0; /** - * Inserts the specified element into this queue, waiting up to the - * specified wait time if necessary for space to become available. + * Inserts the specified element into this queue, waiting up to the specified wait + * time if necessary for space to become available. * * @param e the element to add * @param timeout how long to wait before giving up, in units of @@ -231,43 +229,44 @@ * @return true if successful, or false if * the specified waiting time elapses before space is available * @throws InterruptedException if interrupted while waiting - * @throws ClassCastException if the class of the specified element - * prevents it from being added to this queue * @throws NullPointerException if the specified element is null * @throws IllegalArgumentException if some property of the specified * element prevents it from being added to this queue */ - virtual bool offer(E e, long timeout, TimeUnit unit) - throws InterruptedException; + virtual bool offer( const E& e, long timeout, const TimeUnit& unit ) + throw( decaf::lang::exceptions::InterruptedException, + decaf::lang::exceptions::NullPointerException, + decaf::lang::exceptions::IllegalArgumentException ) = 0; /** - * Retrieves and removes the head of this queue, waiting if necessary - * until an element becomes available. + * Retrieves and removes the head of this queue, waiting if necessary until an + * element becomes available. * * @return the head of this queue * @throws InterruptedException if interrupted while waiting */ - virtual E take() throws InterruptedException; + virtual E take() throw( decaf::lang::exceptions::InterruptedException ) = 0; /** - * Retrieves and removes the head of this queue, waiting up to the - * specified wait time if necessary for an element to become available. + * Retrieves and removes the head of this queue, waiting up to the specified + * wait time if necessary for an element to become available. * - * @param timeout how long to wait before giving up, in units of - * unit + * @param result the referenced value that will be assigned the value + * retrieved from the Queue. Undefined if this methods returned false. + * @param timeout how long to wait before giving up, in units of unit * @param unit a TimeUnit determining how to interpret the - * timeout parameter - * @return the head of this queue, or null if the - * specified waiting time elapses before an element is available + * timeout parameter. + * @return true if successful or false if the specified + * waiting time elapses before an element is available. * @throws InterruptedException if interrupted while waiting */ - virtual E poll(long timeout, TimeUnit unit) - throws InterruptedException; + virtual bool poll( E& result, long long timeout, const TimeUnit& unit ) + throw( decaf::lang::exceptions::InterruptedException ) = 0; /** * Returns the number of additional elements that this queue can ideally * (in the absence of memory or resource constraints) accept without - * blocking, or Integer.MAX_VALUE if there is no intrinsic + * blocking, or Integer::MAX_VALUE if there is no intrinsic * limit. * *

Note that you cannot always tell if an attempt to insert @@ -277,7 +276,7 @@ * * @return the remaining capacity */ - virtual int remainingCapacity(); + virtual int remainingCapacity() = 0; /** * Removes a single instance of the specified element from this queue, @@ -287,13 +286,13 @@ * Returns true if this queue contained the specified element * (or equivalently, if this queue changed as a result of the call). * - * @param o element to be removed from this queue, if present + * @param value element to be removed from this queue, if present * @return true if this queue changed as a result of the call - * @throws ClassCastException if the class of the specified element - * is incompatible with this queue (optional) + * * @throws NullPointerException if the specified element is null (optional) */ - virtual bool remove(Object o); + virtual bool remove( const E& value ) + throw( decaf::lang::exceptions::NullPointerException ) = 0; /** * Returns true if this queue contains the specified element. @@ -302,36 +301,32 @@ * * @param o object to be checked for containment in this queue * @return true if this queue contains the specified element - * @throws ClassCastException if the class of the specified element - * is incompatible with this queue (optional) * @throws NullPointerException if the specified element is null (optional) */ - virtual bool contains(Object o); + virtual bool contains( const E& value ) + throw( decaf::lang::exceptions::NullPointerException ) = 0; /** - * Removes all available elements from this queue and adds them - * to the given collection. This operation may be more - * efficient than repeatedly polling this queue. A failure - * encountered while attempting to add elements to - * collection c may result in elements being in neither, - * either or both collections when the associated exception is - * thrown. Attempts to drain a queue to itself result in - * IllegalArgumentException. Further, the behavior of - * this operation is undefined if the specified collection is - * modified while the operation is in progress. + * Removes all available elements from this queue and adds them to the given + * collection. This operation may be more efficient than repeatedly polling + * this queue. A failure encountered while attempting to add elements to + * collection c may result in elements being in neither, either or + * both collections when the associated exception is thrown. Attempts to + * drain a queue to itself result in IllegalArgumentException. + * Further, the behavior of this operation is undefined if the specified + * collection is modified while the operation is in progress. * * @param c the collection to transfer elements into * @return the number of elements transferred * @throws UnsupportedOperationException if addition of elements * is not supported by the specified collection - * @throws ClassCastException if the class of an element of this queue - * prevents it from being added to the specified collection - * @throws NullPointerException if the specified collection is null * @throws IllegalArgumentException if the specified collection is this * queue, or some property of an element of this queue prevents * it from being added to the specified collection */ - virtual int drainTo(Collection c); + virtual int drainTo( Collection& c ) + throw( decaf::lang::exceptions::UnsupportedOperationException, + decaf::lang::exceptions::IllegalArgumentException ) = 0; /** * Removes at most the given number of available elements from @@ -349,14 +344,13 @@ * @return the number of elements transferred * @throws UnsupportedOperationException if addition of elements * is not supported by the specified collection - * @throws ClassCastException if the class of an element of this queue - * prevents it from being added to the specified collection - * @throws NullPointerException if the specified collection is null * @throws IllegalArgumentException if the specified collection is this * queue, or some property of an element of this queue prevents * it from being added to the specified collection */ - virtual int drainTo( Collection c, int maxElements ) = 0; + virtual int drainTo( Collection& c, int maxElements ) + throw( decaf::lang::exceptions::UnsupportedOperationException, + decaf::lang::exceptions::IllegalArgumentException ) = 0; }; Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CountDownLatch.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CountDownLatch.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CountDownLatch.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CountDownLatch.h Mon Aug 31 19:24:08 2009 @@ -51,7 +51,7 @@ /** * Waits for the Count to be zero, and then returns - * @throws CMSException + * @throws Exception */ virtual void await() throw ( lang::Exception ); Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h?rev=809703&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h Mon Aug 31 19:24:08 2009 @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _DECAF_UTIL_CONCURRENT_SYNCHRONOUSQUEUE_H_ +#define _DECAF_UTIL_CONCURRENT_SYNCHRONOUSQUEUE_H_ + +#include + +#include + +namespace decaf { +namespace util { +namespace concurrent { + + /** + * A {@linkplain BlockingQueue blocking queue} in which each insert operation + * must wait for a corresponding remove operation by another thread, and + * vice versa. A synchronous queue does not have any internal capacity, + * not even a capacity of one. You cannot peek at a synchronous + * queue because an element is only present when you try to remove it; you + * cannot insert an element (using any method) unless another thread is trying + * to remove it; you cannot iterate as there is nothing to iterate. The + * head of the queue is the element that the first queued inserting + * thread is trying to add to the queue; if there is no such queued thread + * then no element is available for removal and poll() will return + * null. For purposes of other Collection methods (for + * example contains), a SynchronousQueue acts as an + * empty collection. This queue does not permit null elements. + * + *

Synchronous queues are similar to rendezvous channels used in + * CSP and Ada. They are well suited for handoff designs, in which an + * object running in one thread must sync up with an object running + * in another thread in order to hand it some information, event, or + * task. + * + *

This class supports an optional fairness policy for ordering + * waiting producer and consumer threads. By default, this ordering + * is not guaranteed. However, a queue constructed with fairness set + * to true grants threads access in FIFO order. + * + *

This class and its iterator implement all of the + * optional methods of the {@link Collection} and {@link + * Iterator} interfaces. + * + * @since 1.0 + */ + template< typename E > + class SynchronousQueue : public BlockingQueue { + private: + + SynchronousQueue( const SynchronousQueue& ); + SynchronousQueue& operator= ( const SynchronousQueue& ); + + public: + + SynchronousQueue() {} + + virtual ~SynchronousQueue() {} + + }; + +}}} + +#endif /* _DECAF_UTIL_CONCURRENT_SYNCHRONOUSQUEUE_H_ */ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/SynchronousQueue.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/ConsoleHandler.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/ConsoleHandler.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/ConsoleHandler.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/ConsoleHandler.h Mon Aug 31 19:24:08 2009 @@ -64,9 +64,9 @@ *

* Override the StreamHandler close to flush the Std Err stream * but doesn't close. - * @throw CMSException + * @throw IOException */ - virtual void close() throw ( cms::CMSException ) + virtual void close() throw ( IOException ) { if( getOutputStream() ) { getOutputStream->flush(); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/StreamHandler.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/StreamHandler.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/StreamHandler.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/StreamHandler.h Mon Aug 31 19:24:08 2009 @@ -82,9 +82,9 @@ * After close has been called this Handler should no longer be used. * Method calls may either be silently ignored or may throw runtime * exceptions. - * @throw CMSException + * @throw IOException */ - virtual void close() throw ( cms::CMSException ) { + virtual void close() throw ( decaf::io::IOException ) { if( stream ) { stream.flush(); stream.close(); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp Mon Aug 31 19:24:08 2009 @@ -60,7 +60,7 @@ } //////////////////////////////////////////////////////////////////////////////// -void CMSProvider::close() throw( decaf::lang::Exception ) { +void CMSProvider::close() throw( decaf::io::IOException ) { if( this->consumer.get() != NULL ) { try{ Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.h?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.h Mon Aug 31 19:24:08 2009 @@ -64,7 +64,7 @@ virtual ~CMSProvider(); - virtual void close() throw( decaf::lang::Exception ); + virtual void close() throw( decaf::io::IOException ); std::string getBrokerURL() const { return this->brokerURL; Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am Mon Aug 31 19:24:08 2009 @@ -122,6 +122,7 @@ decaf/util/concurrent/ConcurrentStlMapTest.cpp \ decaf/util/concurrent/CountDownLatchTest.cpp \ decaf/util/concurrent/MutexTest.cpp \ + decaf/util/concurrent/SynchronousQueueTest.cpp \ decaf/util/concurrent/ThreadPoolTest.cpp \ decaf/util/concurrent/TimeUnitTest.cpp \ decaf/util/concurrent/atomic/AtomicBooleanTest.cpp \ @@ -247,6 +248,7 @@ decaf/util/concurrent/ConcurrentStlMapTest.h \ decaf/util/concurrent/CountDownLatchTest.h \ decaf/util/concurrent/MutexTest.h \ + decaf/util/concurrent/SynchronousQueueTest.h \ decaf/util/concurrent/ThreadPoolTest.h \ decaf/util/concurrent/TimeUnitTest.h \ decaf/util/concurrent/atomic/AtomicBooleanTest.h \ Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp?rev=809703&r1=809702&r2=809703&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/correlator/ResponseCorrelatorTest.cpp Mon Aug 31 19:24:08 2009 @@ -116,7 +116,7 @@ return this->listener; } - virtual void start() throw( cms::CMSException ){ + virtual void start() throw( decaf::io::IOException ){ close(); done = false; @@ -124,7 +124,10 @@ thread->start(); } - virtual void close() throw( cms::CMSException ){ + virtual void stop() throw( decaf::io::IOException ){ + } + + virtual void close() throw( decaf::io::IOException ){ done = true;