• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how many threads are created by JME VM?

 
ying lam
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If my midlet does not create any thread, how many threads are created by JME VM when running my midlet?

1. Main thread for my application?
2. Display thread for painting my applicaition?
3. Event handling thread when users click any key?

Thank you.
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it matter? Why?

I wouldn't make any major design decisions based on how many threads are running in the JVM. The only threads you can be sure of are the ones you create - and, of course, the main thread. The JVM vendor may create and destroy threads at need, and the number of system threads may vary unpredictably between different vendors and different JVM releases.
 
ying lam
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ask because I need to know what data structure needs to be synchronized.

For example, i need to build a blackjack game in j2me.

I have a button called 'Hit' (means add a card to my current hand).

And in my paint() method, it will paint all the cards in my current hand.

So do I need to be synchronized when I add a new card to my current hand.

Thank you.
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to know anything about threading for that. Just have the logic that updates the hand invalidate the display. That will cause the paint to be queued and executed. Normally, that's all you need.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic