aspose file tools*
The moose likes Threads and Synchronization and the fly likes Thread doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread doubt" Watch "Thread doubt" New topic
Author

Thread doubt

nmohan kumar
Greenhorn

Joined: Mar 01, 2010
Posts: 6
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

Joined: Aug 25, 2008
Posts: 149

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

Joined: Apr 04, 2005
Posts: 73
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)


Regards,
Alan Mehio
London, UK
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread doubt