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/03/30 23:39:45 UTC
svn commit: r1307627 - in
/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels:
ActiveMQProducerKernel.cpp ActiveMQSessionKernel.cpp ActiveMQSessionKernel.h
Author: tabish
Date: Fri Mar 30 21:39:44 2012
New Revision: 1307627
URL: http://svn.apache.org/viewvc?rev=1307627&view=rev
Log:
Fix up the producer remove now that the kernels are all in place.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp?rev=1307627&r1=1307626&r2=1307627&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQProducerKernel.cpp Fri Mar 30 21:39:44 2012
@@ -115,7 +115,13 @@ void ActiveMQProducerKernel::close() {
void ActiveMQProducerKernel::dispose() {
if (!this->isClosed()) {
- this->session->removeProducer(this->producerInfo->getProducerId());
+ Pointer<ActiveMQProducerKernel> producer(this);
+ try {
+ this->session->removeProducer(producer);
+ } catch(Exception& e) {
+ producer.release();
+ throw;
+ }
this->closed = true;
}
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp?rev=1307627&r1=1307626&r2=1307627&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp Fri Mar 30 21:39:44 2012
@@ -626,7 +626,7 @@ cms::MessageProducer* ActiveMQSessionKer
this->addProducer(producer);
this->connection->oneway(producer->getProducerInfo());
} catch (Exception& ex) {
- this->removeProducer(producer->getProducerId());
+ this->removeProducer(producer);
throw ex;
}
@@ -1145,28 +1145,14 @@ void ActiveMQSessionKernel::addProducer(
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSessionKernel::removeProducer(const Pointer<commands::ProducerId>& producerId) {
+void ActiveMQSessionKernel::removeProducer(Pointer<ActiveMQProducerKernel> producer) {
try{
this->checkClosed();
- this->connection->removeProducer(producerId);
-
- std::auto_ptr<Iterator<Pointer< ActiveMQProducerKernel> > > producerIter(this->config->producers.iterator());
-
- Pointer<ActiveMQProducerKernel> toRemove;
- while (producerIter->hasNext()) {
- Pointer<ActiveMQProducerKernel> temp = producerIter->next();
- if (temp->getProducerId()->equals(*producerId)) {
- toRemove = temp;
- break;
- }
- }
-
- if (toRemove != NULL) {
- this->config->producers.remove(toRemove);
- }
+ this->connection->removeProducer(producer->getProducerId());
+ this->config->producers.remove(producer);
}
AMQ_CATCH_RETHROW( ActiveMQException )
AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h?rev=1307627&r1=1307626&r2=1307627&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.h Fri Mar 30 21:39:44 2012
@@ -402,12 +402,12 @@ namespace kernels {
* Dispose of a MessageProducer from this session. Removes it from the Connection
* and clean up any resources associated with it.
*
- * @param producerId
- * The ProducerId of the producer to remove to this session.
+ * @param producer
+ * The Producer kernel instance to remove from this session.
*
* @throw ActiveMQException if an internal error occurs.
*/
- void removeProducer(const Pointer<commands::ProducerId>& producerId);
+ void removeProducer(Pointer<activemq::core::kernels::ActiveMQProducerKernel> producer);
/**
* Starts if not already start a Transaction for this Session. If the session