You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Radek Wisniewski <rw...@datenknecht.de> on 2001/08/28 16:40:02 UTC

RE: RE: How to share a variable of a service class among differen t clients' requests?

It't an emerging concept of an shared context.
Probably the best solution, in the "SOAP-ing" environment ist to build
special and specialized service that works as "shared context".
Of cource for simplicity, you can build your own class Vector working as
proxy. While putting or getting it schould call propper service.

Be aware of fail ower issues. Microsfts centralized "Passport" concept is
not a good idea.

Radek Wisniewski
www.datenknecht.de

On Tue, 28 Aug 2001, Micael Ericsson (QIN) wrote:

> Correct. Singelton approach only works if 'application' only runs on one webserver/same JVM session.
>
> Database or shared property file is another approach for 'global settings'.
>
> /Micael E.
>
> -----Original Message-----
> From: federico.fiorillo@inwind.it [mailto:federico.fiorillo@inwind.it]
> Sent: Tuesday, August 28, 2001 3:45 PM
> To: soap-user@xml.apache.org
> Subject: RE:RE: How to share a variable of a service class among
> different clients' requests?
>
>
> but a request to a web server is statless.
> the only think that you can do is: do a request and listen a response. different thinks are out of 'normal' implementation. the concept of static variable are a forced work that a web server can do and onother web server cannot. i think you need to find others solution at you software. again, consider tha case where you have a balancing between some machine. who of these have you static variable?
>
> federico
>
> ps: sorry for my english.
>
> >>>>>>
>
> Design pattern Singelton solves this. Creating one unique instance that can be acces by several 'services'. This instance 'lives' from first acces until webserver/soap stops.
>
> Creating this in Java is easy:
> - make constructor private so that it is not accesible from outside
> - make a static method for getting sole instance like:
> >final public class GlobalSettings
> >{
> >  private globalSettings() {};
> >  public static GlobalSettings getInstance()
> >  {
> >	if (soleInstance == null)
> >		soleInstance = new GlobalSettings ();
> >	return soleInstance;
> >  }
> >  ...
> >}
> >private GlobalSettings soleInstance = null;
>
> Then add get/set methods for parameters you want to share.
>
> /Micael E.
>
> -----Original Message-----
> From: Wenbiao Han [mailto:wenbiao.han@ulticom.com]
> Sent: Tuesday, August 28, 2001 3:11 PM
> To: soap-user@xml.apache.org
> Subject: How to share a variable of a service class among different
> clients' requests?
>
>
>  Hi:
>
>  Suppose a member variable x of a Java service class X has a HashTable type,
> I am wondering how the different clients can add or delete entries in the
> variable x? Can I set the scope of the service class as "application" and
> synchronize the adding/deleting mehods when the client
> wants to add/delete the HashTable entries?
>
>  As I understand, only one instance of a service class is created if
> "application" scope is set. The question is whether the same variable
> instance X.x can be accessed by different clients?
>
>  Thanks in advance for your answers
>
> Kelvin
>


RE: RE: How to share a variable of a service class among differen t clients' requests?

Posted by Dmitri Colebatch <di...@bigpond.net.au>.
On Tue, 28 Aug 2001, Radek Wisniewski wrote:

> Be aware of fail ower issues. Microsfts centralized "Passport" concept is
> not a good idea.

why not?  we are looking at a similar solution and I'd be interested to
hear criticisms and alternatives.

cheesr
dim



> 
> Radek Wisniewski
> www.datenknecht.de
> 
> On Tue, 28 Aug 2001, Micael Ericsson (QIN) wrote:
> 
> > Correct. Singelton approach only works if 'application' only runs on one webserver/same JVM session.
> >
> > Database or shared property file is another approach for 'global settings'.
> >
> > /Micael E.
> >
> > -----Original Message-----
> > From: federico.fiorillo@inwind.it [mailto:federico.fiorillo@inwind.it]
> > Sent: Tuesday, August 28, 2001 3:45 PM
> > To: soap-user@xml.apache.org
> > Subject: RE:RE: How to share a variable of a service class among
> > different clients' requests?
> >
> >
> > but a request to a web server is statless.
> > the only think that you can do is: do a request and listen a response. different thinks are out of 'normal' implementation. the concept of static variable are a forced work that a web server can do and onother web server cannot. i think you need to find others solution at you software. again, consider tha case where you have a balancing between some machine. who of these have you static variable?
> >
> > federico
> >
> > ps: sorry for my english.
> >
> > >>>>>>
> >
> > Design pattern Singelton solves this. Creating one unique instance that can be acces by several 'services'. This instance 'lives' from first acces until webserver/soap stops.
> >
> > Creating this in Java is easy:
> > - make constructor private so that it is not accesible from outside
> > - make a static method for getting sole instance like:
> > >final public class GlobalSettings
> > >{
> > >  private globalSettings() {};
> > >  public static GlobalSettings getInstance()
> > >  {
> > >	if (soleInstance == null)
> > >		soleInstance = new GlobalSettings ();
> > >	return soleInstance;
> > >  }
> > >  ...
> > >}
> > >private GlobalSettings soleInstance = null;
> >
> > Then add get/set methods for parameters you want to share.
> >
> > /Micael E.
> >
> > -----Original Message-----
> > From: Wenbiao Han [mailto:wenbiao.han@ulticom.com]
> > Sent: Tuesday, August 28, 2001 3:11 PM
> > To: soap-user@xml.apache.org
> > Subject: How to share a variable of a service class among different
> > clients' requests?
> >
> >
> >  Hi:
> >
> >  Suppose a member variable x of a Java service class X has a HashTable type,
> > I am wondering how the different clients can add or delete entries in the
> > variable x? Can I set the scope of the service class as "application" and
> > synchronize the adding/deleting mehods when the client
> > wants to add/delete the HashTable entries?
> >
> >  As I understand, only one instance of a service class is created if
> > "application" scope is set. The question is whether the same variable
> > instance X.x can be accessed by different clients?
> >
> >  Thanks in advance for your answers
> >
> > Kelvin
> >
> 
> 


RE: RE: How to share a variable of a service class among differen t clients' requests?

Posted by Dmitri Colebatch <di...@bigpond.net.au>.
On Tue, 28 Aug 2001, Radek Wisniewski wrote:

> Be aware of fail ower issues. Microsfts centralized "Passport" concept is
> not a good idea.

why not?  we are looking at a similar solution and I'd be interested to
hear criticisms and alternatives.

cheesr
dim



> 
> Radek Wisniewski
> www.datenknecht.de
> 
> On Tue, 28 Aug 2001, Micael Ericsson (QIN) wrote:
> 
> > Correct. Singelton approach only works if 'application' only runs on one webserver/same JVM session.
> >
> > Database or shared property file is another approach for 'global settings'.
> >
> > /Micael E.
> >
> > -----Original Message-----
> > From: federico.fiorillo@inwind.it [mailto:federico.fiorillo@inwind.it]
> > Sent: Tuesday, August 28, 2001 3:45 PM
> > To: soap-user@xml.apache.org
> > Subject: RE:RE: How to share a variable of a service class among
> > different clients' requests?
> >
> >
> > but a request to a web server is statless.
> > the only think that you can do is: do a request and listen a response. different thinks are out of 'normal' implementation. the concept of static variable are a forced work that a web server can do and onother web server cannot. i think you need to find others solution at you software. again, consider tha case where you have a balancing between some machine. who of these have you static variable?
> >
> > federico
> >
> > ps: sorry for my english.
> >
> > >>>>>>
> >
> > Design pattern Singelton solves this. Creating one unique instance that can be acces by several 'services'. This instance 'lives' from first acces until webserver/soap stops.
> >
> > Creating this in Java is easy:
> > - make constructor private so that it is not accesible from outside
> > - make a static method for getting sole instance like:
> > >final public class GlobalSettings
> > >{
> > >  private globalSettings() {};
> > >  public static GlobalSettings getInstance()
> > >  {
> > >	if (soleInstance == null)
> > >		soleInstance = new GlobalSettings ();
> > >	return soleInstance;
> > >  }
> > >  ...
> > >}
> > >private GlobalSettings soleInstance = null;
> >
> > Then add get/set methods for parameters you want to share.
> >
> > /Micael E.
> >
> > -----Original Message-----
> > From: Wenbiao Han [mailto:wenbiao.han@ulticom.com]
> > Sent: Tuesday, August 28, 2001 3:11 PM
> > To: soap-user@xml.apache.org
> > Subject: How to share a variable of a service class among different
> > clients' requests?
> >
> >
> >  Hi:
> >
> >  Suppose a member variable x of a Java service class X has a HashTable type,
> > I am wondering how the different clients can add or delete entries in the
> > variable x? Can I set the scope of the service class as "application" and
> > synchronize the adding/deleting mehods when the client
> > wants to add/delete the HashTable entries?
> >
> >  As I understand, only one instance of a service class is created if
> > "application" scope is set. The question is whether the same variable
> > instance X.x can be accessed by different clients?
> >
> >  Thanks in advance for your answers
> >
> > Kelvin
> >
> 
>