You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by di...@capgemini-sdm.com on 2009/08/25 12:05:37 UTC

Web Service Synchronization

Hi all,

I got a question about cxf web services. I require synchronization in the web methods since the users that are calling them should be logged and of couse is important that a web method call fnish before another user calls the same method. The question is: are by default the call of the web methods synchonized? Or should I synchronize the access?

Thanks a lot,

-Diego Vera

Re: AW: Web Service Synchronization

Posted by Daniel Kulp <dk...@apache.org>.
On Wed August 26 2009 8:51:36 am diego.vera@capgemini-sdm.com wrote:
> Hi Daniel,
>
> Thanks for your answer, I want to try the factories that are implemented in
> cxf, however I am having trouble to figure out where to configure the
> factories for an endpoint. Is there anywhere a sample about it?

You can see some java code for how to configure it via code in our system 
tests:
http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java

To do it via spring config would require configuring a couple objects:

1) The actual factory

2) An invoker that holds the factory.   For JAX-WS, that would be a 
JAXWSMethodInvoker.

3) Set that invoker onto the jaxws:endpoint or jaxws:server via the invoker 
child element.

Dan


>
> Thanks in advance,
>
> -Diego Vera
>
> -----Ursprüngliche Nachricht-----
> Von: Daniel Kulp [mailto:dkulp@apache.org]
> Gesendet: Dienstag, 25. August 2009 20:54
> An: users@cxf.apache.org
> Cc: Vera, Diego
> Betreff: Re: Web Service Synchronization
>
>
> I guess it kind of depends on what you are trying to accomplish.
>
> By default, we only create a single instance of the service bean and thus
> it SHOULD be properly re-entrant.    However, there are ways to deal with
> it. One option is to use the spring aspects and set the scope to "session".
> Thus, each session would create a new instance.   A particular client (make
> sure they turn on sessions support) would then be the only one interacting
> with that object.  I think spring has some "per call" type  things as well.
>
> Alternatively, built into CXF, we have factories that can be configured in
> that would use a pool of instances to service requests or do "per request"
> of similar.   Or, you could write our own factory that could do whatever
> you need to do.  See:
>
> http://cxf.apache.org/javadoc/latest/org/apache/cxf/service/invoker/package
>- summary.html
>
> (SingletonFactory is the default)
>
> Dan
>
> On Tue August 25 2009 6:05:37 am diego.vera@capgemini-sdm.com wrote:
> > Hi all,
> >
> > I got a question about cxf web services. I require synchronization in
> > the web methods since the users that are calling them should be logged
> > and of couse is important that a web method call fnish before another
> > user calls the same method. The question is: are by default the call
> > of the web methods synchonized? Or should I synchronize the access?
> >
> > Thanks a lot,
> >
> > -Diego Vera
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

AW: Web Service Synchronization

Posted by di...@capgemini-sdm.com.
Hi Daniel,

Thanks for your answer, I want to try the factories that are implemented in cxf, however I am having trouble to figure out where to configure the factories for an endpoint. Is there anywhere a sample about it?

Thanks in advance,

-Diego Vera 

-----Ursprüngliche Nachricht-----
Von: Daniel Kulp [mailto:dkulp@apache.org] 
Gesendet: Dienstag, 25. August 2009 20:54
An: users@cxf.apache.org
Cc: Vera, Diego
Betreff: Re: Web Service Synchronization


I guess it kind of depends on what you are trying to accomplish.

By default, we only create a single instance of the service bean and thus it 
SHOULD be properly re-entrant.    However, there are ways to deal with it.   
One option is to use the spring aspects and set the scope to "session".   
Thus, each session would create a new instance.   A particular client (make 
sure they turn on sessions support) would then be the only one interacting with that object.  I think spring has some "per call" type  things as well.

Alternatively, built into CXF, we have factories that can be configured in that would use a pool of instances to service requests or do "per request" of 
similar.   Or, you could write our own factory that could do whatever you need 
to do.  See:

http://cxf.apache.org/javadoc/latest/org/apache/cxf/service/invoker/package-
summary.html

(SingletonFactory is the default)

Dan


On Tue August 25 2009 6:05:37 am diego.vera@capgemini-sdm.com wrote:
> Hi all,
>
> I got a question about cxf web services. I require synchronization in 
> the web methods since the users that are calling them should be logged 
> and of couse is important that a web method call fnish before another 
> user calls the same method. The question is: are by default the call 
> of the web methods synchonized? Or should I synchronize the access?
>
> Thanks a lot,
>
> -Diego Vera

--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Web Service Synchronization

Posted by Daniel Kulp <dk...@apache.org>.
I guess it kind of depends on what you are trying to accomplish.

By default, we only create a single instance of the service bean and thus it 
SHOULD be properly re-entrant.    However, there are ways to deal with it.   
One option is to use the spring aspects and set the scope to "session".   
Thus, each session would create a new instance.   A particular client (make 
sure they turn on sessions support) would then be the only one interacting 
with that object.  I think spring has some "per call" type  things as well.

Alternatively, built into CXF, we have factories that can be configured in 
that would use a pool of instances to service requests or do "per request" of 
similar.   Or, you could write our own factory that could do whatever you need 
to do.  See:

http://cxf.apache.org/javadoc/latest/org/apache/cxf/service/invoker/package-
summary.html

(SingletonFactory is the default)

Dan


On Tue August 25 2009 6:05:37 am diego.vera@capgemini-sdm.com wrote:
> Hi all,
>
> I got a question about cxf web services. I require synchronization in the
> web methods since the users that are calling them should be logged and of
> couse is important that a web method call fnish before another user calls
> the same method. The question is: are by default the call of the web
> methods synchonized? Or should I synchronize the access?
>
> Thanks a lot,
>
> -Diego Vera

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

AW: Web Service Synchronization

Posted by di...@capgemini-sdm.com.
Hi all,

What I exactly mean is the concurrency control in the web service. I have a web service where users write information that they store in a list, and this list could be very large, that is why I see if I do not control the concurrence to this web method, some information could be stored in the profile of one users and the other in the profile of the other user, but the list should be stored in the profile of the right user, without concurrence control it could happen that the information is stored for the incorrect user. The solution proposed by Glen could work (locking the data base), however every entry in the list is independent that is why I was thinking that controlling the concurrency in the web method could be a better solution. Is there a better approach?

Thanks in advance,

-Diego Vera

-----Ursprüngliche Nachricht-----
Von: Benson Margulies [mailto:bimargulies@gmail.com] 
Gesendet: Dienstag, 25. August 2009 13:57
An: users@cxf.apache.org
Betreff: Re: Web Service Synchronization

Let's be a bit more specific. Are you concerned with the reentrancy of your implementation or of the client stubs?

On Tue, Aug 25, 2009 at 7:17 AM, Glen Mazza<gl...@gmail.com> wrote:
>
> Synchronous/Asynchronous has a different meaning with web services, 
> but using your standard definition of synchronous, I can't imagine web 
> methods being synchronized by default, because that would slow down 
> read-only web methods such as getCapitalOfBritain that don't require 
> synchronization.  I'm unsure how the lack of synchronization would 
> prevent you from logging who accesses your web service, and for 
> writable web services that access a database, I would first check to 
> make sure that the database would not take care of the synchronization 
> for you anyway (i.e., some databases lock during 
> insert/updates/deletes, not allowing other calls to proceed until 
> finished.)
>
> HTH,
> Glen
>
>
> diego.vera wrote:
>>
>> Hi all,
>>
>> I got a question about cxf web services. I require synchronization in 
>> the web methods since the users that are calling them should be 
>> logged and of couse is important that a web method call fnish before 
>> another user calls the same method. The question is: are by default 
>> the call of the web methods synchonized? Or should I synchronize the access?
>>
>> Thanks a lot,
>>
>> -Diego Vera
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Web-Service-Synchronization-tp25131659p25132477.
> html Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Web Service Synchronization

Posted by Benson Margulies <bi...@gmail.com>.
Let's be a bit more specific. Are you concerned with the reentrancy of
your implementation or of the client stubs?

On Tue, Aug 25, 2009 at 7:17 AM, Glen Mazza<gl...@gmail.com> wrote:
>
> Synchronous/Asynchronous has a different meaning with web services, but using
> your standard definition of synchronous, I can't imagine web methods being
> synchronized by default, because that would slow down read-only web methods
> such as getCapitalOfBritain that don't require synchronization.  I'm unsure
> how the lack of synchronization would prevent you from logging who accesses
> your web service, and for writable web services that access a database, I
> would first check to make sure that the database would not take care of the
> synchronization for you anyway (i.e., some databases lock during
> insert/updates/deletes, not allowing other calls to proceed until finished.)
>
> HTH,
> Glen
>
>
> diego.vera wrote:
>>
>> Hi all,
>>
>> I got a question about cxf web services. I require synchronization in the
>> web methods since the users that are calling them should be logged and of
>> couse is important that a web method call fnish before another user calls
>> the same method. The question is: are by default the call of the web
>> methods synchonized? Or should I synchronize the access?
>>
>> Thanks a lot,
>>
>> -Diego Vera
>>
>
> --
> View this message in context: http://www.nabble.com/Web-Service-Synchronization-tp25131659p25132477.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: Web Service Synchronization

Posted by Glen Mazza <gl...@gmail.com>.
Synchronous/Asynchronous has a different meaning with web services, but using
your standard definition of synchronous, I can't imagine web methods being
synchronized by default, because that would slow down read-only web methods
such as getCapitalOfBritain that don't require synchronization.  I'm unsure
how the lack of synchronization would prevent you from logging who accesses
your web service, and for writable web services that access a database, I
would first check to make sure that the database would not take care of the
synchronization for you anyway (i.e., some databases lock during
insert/updates/deletes, not allowing other calls to proceed until finished.)

HTH,
Glen


diego.vera wrote:
> 
> Hi all,
> 
> I got a question about cxf web services. I require synchronization in the
> web methods since the users that are calling them should be logged and of
> couse is important that a web method call fnish before another user calls
> the same method. The question is: are by default the call of the web
> methods synchonized? Or should I synchronize the access?
> 
> Thanks a lot,
> 
> -Diego Vera
> 

-- 
View this message in context: http://www.nabble.com/Web-Service-Synchronization-tp25131659p25132477.html
Sent from the cxf-user mailing list archive at Nabble.com.