On Mon, 2011-01-17 at 14:05 +0100, Oscar Pernas wrote:
> Hi all,
> 
> 
> I've found the problem. The problem was that when you make the
> connection->start(); if it is impossible to connect to broker, ActiveMQ-cpp
> throws an exception. I catch this exception and call to cleanup method to
> free all resources.
> In the moment that I'm deleting resources, particulary connection pointer,
> the library call to the mutex.wait method with 15 seconds time and takes the
> 100% usage of the CPU. Particulary in this disconnect:
> 
>         // Now inform the Broker we are shutting down.
>         this->disconnect( lastDeliveredSequenceId );
> 
> 

Without some code samples to show how you are using the library its hard
to make a determination about what is going on.  Can you provide a
sample app that demonstrates the issue?

Regards



> I saw that is the WaitForSIngleObject the method that produces the high cpu
> load.
> 
> 
> If the connection cannot start, I have to make a close, but it hangs my cpu,
> If I catch the exception could I set  connection to NULL or will be a leak?
> 
> Any other idea to close connection resource withouth this cpu high load?
> 
> 2011/1/17 Oscar Pernas <os...@pernas.es>
> 
> > Hi all,
> >
> >
> > I am developing an application that uses JMS and needs to start with or
> > without the connection to broker was stablished or not. For this, I am
> > coding a reconnect thread that is spawned when the initial reconnects fail.
> > I've set this connection strings:
> >
> > failover://(tcp://10.0.2.22:61616
> > )?startupMaxReconnectAttempts=1&initialReconnectDelay=1&maxReconnectDelay=1
> >
> >
> > When the application starts and try to connect, if it fails, the thread is
> > spawned and trying to reconnect every 30 seconds, with this case I can see
> > two weirds behaviours.
> >
> > - Every time that the thread wants to reconnect, the process eats the 100%
> > of the cpu. I've follow the code and I dont know why, but in the function
> >
> > bool CountDownLatch::await( long long timeOut )
> >
> > I have a mutex wait timeOut that is equal to 15000 seconds.
> >
> >             mutex.wait( timeOut );
> >
> > Why the code is waiting 15000 seconds? why it takes the 100% of the cpu?
> >
> > The await function is called by:
> >
> > Pointer<Response> ResponseCorrelator::request  -->  response =
> > futureResponse->getResponse( timeout );
> >
> >
> > Im developing in windows 2000.
> >
> >
> >
> > Regards
> >
> >
> >
> >
> > --
> > Óscar Pernas Plaza.
> >
> 
> 
> 

-- 
Tim Bish
------------
FuseSource
Email: tim.b...@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/


Reply via email to