• 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

Running threads in Sequence

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have a question, suppose we have 100 threads e.g T1, T2, T3 . . . T100. I want threads to run in sequence. First T1 completes then T2, then T3….at last T100. Is there any way to implement this ?
Or
You can say each thread prints its Name .
So my output should be
T1 T2 T3 T4.........T100

Thanks
Gagan.
 
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well there is a way but I don't think that will be too much useful

have you heard of the join method on threads?

can you write code using join method?

 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So basically you want all those thread to run in a single thread. Instead of calling the start method call the run method.
But can you tell us why you created those threads in the first place if you didn't want multi-threaded behaviour.
reply
    Bookmark Topic Watch Topic
  • New Topic