users@glassfish.java.net

Re: Singelton in a jax 2.0 webservice

From: Jagadish Prasath Ramu <Jagadish.Ramu_at_Sun.COM>
Date: Fri, 24 Oct 2008 19:19:47 +0530

Though there isn't a provision as a feature, you can enable
associate-with-thread.
This would associate the connection with the thread (in the server) that
is serving the client.
So, the connection becomes thread specific rather than web-service
specific.
or
Your web-service can use a utility class that caches the connection.

Thanks,
-Jagadish




On Thu, 2008-10-23 at 07:32 -0700, allySan wrote:
> Hi
>
> Recently at work I received an email from a DBA asking if my web service may
> use only one connection to a oracle db. I have created a web service that
> stores some data in the db.
> That means that I now need some kind of a singleton object.
>
> My question is, is it possible to create a connection first time a client is
> using webservice and then reuse this same connection object in another
> client by using Singleton-pattern?
>
>
> Kind regards
> Ally G.