Craig R. McClanahan wrote:

A have to implement some functionality that related to multiple
instances. I need a servlet which accepts common http requests from
client-side applets. When a next request arrives, servlet must
register a client somehow (for example, store its name and, possibly,
access password) and not to close a connection. And, at any time (may
be seconds, minutes or even hours), it have to send every client some
portion of information based on client's needs. In other words, it's a
server-push.
So, I need to share an information between servlets so each of them
cat send it to corresponding client.

How can I do this? This task is too complicated for me, since I'm only
starting write in Java.

Thank you for every answer!

Sounds like you should *really* be using something other than HTTP for
this kind of thing, since there is no such thing as a real "server push".
You might investigate using some sort of IRC environment, or packages like
Jabber <http://www.jabber.org>.
Yes. I only thought that I can thread my servlet so each new client and serve them separately.

It's possible to simulate server-push using web browsers that periodically
poll for new information, but the approach doesn't scale very well -- most
of the time your server will get hammered by requests that don't end up
changing anything, and you can't get information out any faster than the
polling interval of your clients.
It would be too simple, and it's unacceptable.
So, you think it's not possible to do such a thing using Tomcat as an servlet container?

No matter what underlying technology you end up with, I'd suggest doing
some research on how multiple threads work in Java.  One good starting
place for that is the Java Language Tutorial
(http://java.sun.com/docs/books/tutorial).
Thank you for your help!



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to