activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oscar Pernas <os...@pernas.es>
Subject Re: ActiveMQ-CPP. mutex.wait( timeOut );
Date Mon, 17 Jan 2011 13:05:19 GMT
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 );


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 <oscar@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.
>



-- 
Óscar Pernas Plaza.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message