• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

how many threads are created by JME VM?  RSS feed

 
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.
 
Bartender
Posts: 19668
92
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
Bartender
Posts: 19668
92
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!