Yes, it would be a better solution, but it would need some refactoring and
probably will do it for beta release.

Adding thread.sleep made all the Stratos processes run with 0-1% CPU usage
where earlier some of them were 100-200%.


On Tue, Feb 18, 2014 at 11:17 PM, Afkham Azeez <[email protected]> wrote:

> Nice work on finding this issue. There is no excuse for writing such
> sloppy code since all modern IDEs show such code as warnings. BTW the
> correct fix for this would be to use an executor, not Thread.sleep
> On Feb 17, 2014 5:20 PM, "Nirmal Fernando" <[email protected]> wrote:
>
>> Add a bit more,
>>
>> * how I found that CPU is spinning by using the 'top' command and examine
>> the process.
>> * how I found the culprit code is by following
>> http://nirmalfdo.blogspot.com/2013/05/how-to-find-culprit-when-cpu-starts-to.html
>>
>>
>> On Mon, Feb 17, 2014 at 5:09 PM, Nirmal Fernando 
>> <[email protected]>wrote:
>>
>>> Hi Guys,
>>>
>>> Please keep in mind not to use mere while true loops in code, which
>>> leads to CPU spinning issues.
>>>
>>> If you ever want to write an empty while true loop, please add a
>>> Thread.sleep at least.
>>>
>>> I've identified them and fixed in commits; 8c2a02374494d4eb017e2ecff09852
>>> 341606d4d0, ff962936a870590b8f1a722f1e56f4
>>> f05207770e, 3fd80640b2dc49f6107b9c90f39581
>>> 7235c4667d
>>>
>>> Thanks.
>>>
>>> --
>>> Best Regards,
>>> Nirmal
>>>
>>> Nirmal Fernando.
>>> PPMC Member & Committer of Apache Stratos,
>>> Senior Software Engineer, WSO2 Inc.
>>>
>>> Blog: http://nirmalfdo.blogspot.com/
>>>
>>
>>
>>
>> --
>> Best Regards,
>> Nirmal
>>
>> Nirmal Fernando.
>> PPMC Member & Committer of Apache Stratos,
>> Senior Software Engineer, WSO2 Inc.
>>
>> Blog: http://nirmalfdo.blogspot.com/
>>
>


-- 
Best Regards,
Nirmal

Nirmal Fernando.
PPMC Member & Committer of Apache Stratos,
Senior Software Engineer, WSO2 Inc.

Blog: http://nirmalfdo.blogspot.com/

Reply via email to