File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

User created threads in serlvets

 
karthic panneer
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
After a long time i am asking a question.
I have a servlet deployed in tomcat, in that servlet i created a thread listening for some event, the thread will be created for each user. My question is will that thread cause performance issue.

Any Suggestions?

Thanks in advance
Karthic
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by thread created for each user? Do you create a new thread for each request?

if possible You should look for an alternative, creating threads with servlets are not good practise

 
Vinod K Singh
Ranch Hand
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to think about removing these threads as well. If you are creating these threads to perform some tasks parallel then I would suggest to have a look at java.util.concurrent package available Java 5 onwards.
 
karthic panneer
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for Reply

What do you mean by thread created for each user? Do you create a new thread for each request?


When a user login the thread will start for that user and it will be destroyed when the user logged out.

Thanks & Regards
Karthic.P
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems a dangerous task to create a new thread for each logged in user. Thread management could be difficult and may leave some holes (i.e start thread when login, and destroy when logout).
again, starting threads within container isn't a good practice. I would like some experts to speak out on this thing.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
karthic panneer wrote:Thanks for Reply

What do you mean by thread created for each user? Do you create a new thread for each request?


When a user login the thread will start for that user and it will be destroyed when the user logged out.

Thanks & Regards
Karthic.P

Bad idea. Why do you need to do this?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic