Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads and servlet  RSS feed

 
paddy Mahadeva Iyer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guyz,

I have a servlet that initlises and call ths run method of a java class that generates a thread pool and assigns objects to the allowed threads as each of them gets free with an object from the list of objects given to it. Now when i shout down my server by using "kill processid" the server does not get stopped. I can see in the logs



But the server never really stops. But at the same time I stop the use of thread and do a write code to sequentially process and then attempt to shut the server down using the kill command the server shuts down properly.
Can somebody see any reason?
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you elaborate as to what threadpool you are using and how do you shutdown the thread pool.
I am not sure how JBOSS handles "Kill", it may wait for all non-deamon threads to stop.
Can you try doing kill -9 instead of just kill.
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you dump the thread stack traces does that give you a hint ? i.e. issue a QUIT signal if your in UNIX land, it might tell you which thread is waiting on what and give the game away.

I couldn't quite follow if you were implementing your own thread pool or using a server mechanism to obtain one i.e. are you creating the threads or getting the server to create them on your behalf i.e. does JBOSS own the thread pool ?
If it's JBOSS you want to be on a JBOSS forum if its you you want to check your server documentation doesn't tell you\ recommend you not create threads directly as several do.
 
Anirudh Vyas
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Humor me Paddy,

You said :
and assigns objects to the allowed threads as each of them gets free with an object from the list of objects given to it.

can you post Code for this ? like

Executors.newFixedThreadPool(SOME_INT);

// insert subsequent lines here ... ?


And it'd be helpful if you tell me exactly "what" are you trying to achieve. I am sorry i wasn't following what you said up there ...
Regards
Vyas, Anirudh
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!