• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread doubt

 
nmohan kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
will the thread be availabe even if the server gets stopped?

actullay i am running my application on websphere server 6.0.i am using three thread classes.The problem is the server is getting stopped after two threads got finished.

In my servet ,i have coded like,

t1.start();
t2.start();
t3.start();

t2.join();
t2.notify();

i want the third thread to be run after t1,t2 finished running.

t2.join();
t2.notify();

and made the t3 waiting..but the application server gets stopped..

1.is it possible to restart the server,is there any code?
2.will the thread t3 be alive even after the server gets stoped?.


can anyone give me an idea on how to solve this issue?..








 
Matt Cartwright
Ranch Hand
Posts: 152
Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WebSphere or in general all containers have their own thread
management.

So starting your own threads in a container is normally not a
good idea as their behaviour is non-deterministic.

please see Is it okay to use threads in a Websphere® application?

If you want to execute scheduled work you should be using CommonJ timers.

For all other issues WorkManagers have been specified.

For more WebShpere stuff regarding threads please see:
Develop high performance J2EE threads with WebSphere Application Server

Hope that helps
Matt
 
Alan Mehio
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nmohan kumar wrote:will the thread be availabe even if the server gets stopped?

actullay i am running my application on websphere server 6.0.i am using three thread classes.The problem is the server is getting stopped after two threads got finished.

In my servet ,i have coded like,

t1.start();
t2.start();
t3.start();

t2.join();
t2.notify();

i want the third thread to be run after t1,t2 finished running.

t2.join();
t2.notify();

and made the t3 waiting..but the application server gets stopped..

1.is it possible to restart the server,is there any code?
2.will the thread t3 be alive even after the server gets stoped?.


can anyone give me an idea on how to solve this issue?..










to start t3 after t1 and t2

t1.join();
t2.join();

t3.start();

How did you implement your wait for the t3 thread? can you post a working code which shows the case only?

I am not sure what is the implementation of the server stop in your case ( web sphere server 6.0)

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic