G
Ghost
I am trying to determine the best way to manage my Threads. Here is my
situation:
- I have a website that requires a user to login.
- When the user logs in, this creates an instance of my WebUser class.
- WebUser creates a new thread for each new user.
- The WebUser class is used to access information from my server. If
the user requests information from the server (by hitting a web page),
WebUser calls something like: getUserInfo().
Currently, WebUser implements Runnable. When WebUser creates a new
thread, that thread basically performs the following run function:
public void run() {
sleep(1000)
}
WebUser does not need to do anything until the user requests
information. Right now it just sleeps all the time.
Is there a better way to handle the WebUser threads? Should WebUser
subclass Thread?
Thanks for any advice.
situation:
- I have a website that requires a user to login.
- When the user logs in, this creates an instance of my WebUser class.
- WebUser creates a new thread for each new user.
- The WebUser class is used to access information from my server. If
the user requests information from the server (by hitting a web page),
WebUser calls something like: getUserInfo().
Currently, WebUser implements Runnable. When WebUser creates a new
thread, that thread basically performs the following run function:
public void run() {
sleep(1000)
}
WebUser does not need to do anything until the user requests
information. Right now it just sleeps all the time.
Is there a better way to handle the WebUser threads? Should WebUser
subclass Thread?
Thanks for any advice.