Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
tek3
Posts: 190
Registered: ‎07-08-2009
My Device: Not Specified

Too Many Threads Error..??


hi..

Can anyone assist me in getting rid off "Too many Threads Error"??? In my app i am getting images from server and using BitmapField to display them..
I have searched the forums but couldnt get much from that...

kindly help me..

Thanx in advance..
Developer
mantaker
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Too Many Threads Error..??

The only reason to get "Too many threads" error is documented here

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800783/What_Is...

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
tek3
Posts: 190
Registered: ‎07-08-2009
My Device: Not Specified

Re: Too Many Threads Error..??

So how can we get over this problem ??  how to keep total thread count of my app below 16...??

 

 

Developer
tek3
Posts: 190
Registered: ‎07-08-2009
My Device: Not Specified

Re: Too Many Threads Error..??

I am creating separate thread for every image i am getting from the server..
Developer
mantaker
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Too Many Threads Error..??

[ Edited ]

I think you could have a check that Thread.activeCount() doesn't exceed 128.. Alternatively, I would go with system, using invokeLater(), which would always takes care of the multithreading problems.. lol

 

Hope this makes sense..

 

Cheers.. 

 

Edit: "Could", misinterpreted as "Cound" - Fixed..

Message Edited by mantaker on 08-12-2009 11:52 AM
--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Too Many Threads Error..??

My suggestion is to set up a single thread to do the downloading, and queue up the requests.

 

I don't see the value of kicking off 20 threads to download 20 images, on a device with such limited bandwidth.

 

Threads are a valuable and constrained resource on the BB platform.

 

Developer
mantaker
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Too Many Threads Error..??

I would strongly agree with RexDoug! Infact I had suggested the same, but not in a right manner - sorry! Why don't you set up a single thread that fetches the images from the server?

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group