• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how many threads are created by JME VM?

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic