Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

Persistent servlets & inter-servlet communication

Thread view: 
atrauzzi@gmail.com - 23 Sep 2006 02:14 GMT
Just curious to know if there is a way to have a servlet that is not
destroyed at the end of it's request?

Also, is there any way I can get a reference to an instance of a
servlet from somewhere else on the same application server?

(Assuming Sun App Server 9.0)
Arne Vajhøj - 23 Sep 2006 03:16 GMT
> Just curious to know if there is a way to have a servlet that is not
> destroyed at the end of it's request?

A normal servlet is not destroyed at end of request. It is
one object being used by multiple threads.

If you implement SingleThreadModel then you get the behaviour you
describe.

> Also, is there any way I can get a reference to an instance of a
> servlet from somewhere else on the same application server?
>
> (Assuming Sun App Server 9.0)

You don't. You redesign so you do not need it.

(if you really want to then I think you can have
the servlet itself save this somewhere where you can get it)

Arne
Manish Pandit - 23 Sep 2006 03:18 GMT
Hi There,

AFAIK, a servlet does not get destroyed at the end of a request. The
container re-uses a servlet instance (1 and only 1, unless you're
refering to the SingleThreadModel) to "service" the requests in
multiple threads. Could you elaborate on what you are trying to
achieve, and possibly, why you need something like this. Also, since
the container manages the lifecycle of a servlet, you should avoid
situations where you want to get a hold of a servlet instance and
invoke its methods.

-cheers,
Manish

> Just curious to know if there is a way to have a servlet that is not
> destroyed at the end of it's request?
[quoted text clipped - 3 lines]
>
> (Assuming Sun App Server 9.0)
atrauzzi@gmail.com - 23 Sep 2006 16:43 GMT
These are all good explanations towards all my questions.  Thank you.

I just want to have something running server-side that watches and acts
upon messages on a topic via JMS.

On that note, do any of you know of some DECENT JMS tutorials?  Front
to back?  Even sun's "Java EE 5 Tutorial" does a spotty job on
explaining how one can make a JMS application.  All the examples seem
to omit something.

I know exactly how I want to structure this, I just have a difficult
time pulling out the correct understanding of all the seemingly
appropriate Java components to get the job done :D

Thanks again!

- Alex

> Hi There,
>
[quoted text clipped - 17 lines]
> >
> > (Assuming Sun App Server 9.0)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.