You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-users@maven.apache.org by Zsolt <zk...@intland.com> on 2006/04/11 07:38:53 UTC

Is scm-maven thread safe?

Hi,

we plan to use scm-maven from tomcat. Are scm-maven and maven thread safe?

Zsolt




Re: Is scm-maven thread safe?

Posted by Emmanuel Venisse <em...@venisse.net>.
I'm not totally sure but i know that some user use maven-scm in a servlet environment.

Emmanuel

Zsolt a écrit :
> Hi,
> 
> we plan to use scm-maven from tomcat. Are scm-maven and maven thread safe?
> 
> Zsolt
> 
> 
> 
> 
> 
> 


RE: Is scm-maven thread safe?

Posted by Zsolt <zk...@intland.com>.
Does that mean that only one checkout can be running? What happens if a
checkout takes for example hours?

Zsolt

>-----Original Message-----
>From: Trygve Laugstøl [mailto:trygvis@apache.org]
>Sent: Tuesday, April 11, 2006 9:58 AM
>To: scm-users@maven.apache.org
>Subject: Re: Is scm-maven thread safe?
>
>On Tue, 2006-04-11 at 07:38, Zsolt wrote:
>> Hi,
>>
>> we plan to use scm-maven from tomcat. Are scm-maven and maven thread
>safe?
>
>The short answer is: no. Maven SCM is not thread safe, most of Maven
>*should* be, but there's no real guarantee for that. In particular the
>plug-ins might not be thread safe.
>
>If you want to embed Maven SCM and/or Maven itself I would recommend that
>you write a simple thread that takes commands from a servlet/jsp/web action
>and builds stuff in a serial ordering.
>
>Continuum does this all over the place so you can take a look at how it
>does the queuing and execution.
>
>--
>Trygve


Re: Is scm-maven thread safe?

Posted by Emmanuel Venisse <em...@venisse.net>.
Personally, I think it would be better to use maven-scm, not because it's our project, but because 
it's open source and used by a large comunity with maven, so all commands are tested in different 
environment.

We have perhaps some bugs in Maven-SCM core or in providers, but when a bug is found in them, we try 
to fix it asap. So I think you can migrate to maven-scm, bormally all will be ok.

Emmanuel

Zsolt a écrit :
> I gladly add new functionality or providers to the API but I would be
> definitely not the right person to make such modifications in the core API.
> 
> Can somebody make some suggestions? I really have to make a decision:
> maven-scm or not.
> 
> Our internal API supports cvs, svn, vss, pvcs and cm-synergy but maven-scm
> has much more functionally thus I would love to replace our API but I need a
> solution that can be used in a environment with lot of parallel users.
> 
> Zsolt
> 
> 
>>-----Original Message-----
>>From: Trygve Laugstøl [mailto:trygvis@apache.org]
>>Sent: Tuesday, April 11, 2006 2:23 PM
>>To: scm-users@maven.apache.org
>>Subject: RE: Is scm-maven thread safe?
>>
>>On Tue, 2006-04-11 at 14:07, Zsolt wrote:
>>
>>>I have viewed a lot of maven-scm source code (but not maven core) and
>>
>>find
>>
>>>the structure clean and I didn't see anything I would consider this API
>>
>>as
>>
>>>NOT thread safe.
>>>
>>>But it is very important to know from beginning what is NOT thread safe.
>>
>>I
>>
>>>understand that also this API has probably bugs (like our software) but I
>>>need more understanding the multi thread problems we can have or how they
>>>can be prevented (I'm sure you understand, that sometime it is really
>>
>>hard
>>
>>>to reproduce and fix a multi-thread related bug).
>>>
>>>As I described below serialization of the request is not an option
>>
>>because
>>
>>>one user can checkout and a second view resource history the same time.
>>>
>>>Trygve, if I understand you correctly I should somehow assure that I
>>
>>create
>>
>>>a new provider instance for each request.
>>
>>Either that or ensure that all of the providers are thread safe.
>>
>>
>>>I don't know how to do that but think it must be simple.
>>
>>It boils down to either making the providers have this stanza in
>>components.xml:
>>
>> <instatiation-strategy>per-lookup</instatiation-strategy>
>>
>>and then have _each client return the instance_ back to the container so
>>that all requirements can be properly released.
>>
>>The alternative is to make the providers thread safe too which might not be
>>too hard, and the API would be easier to use for the client.
>>
>>I'm not entirely sure what the best way is but I would suggest that one
>>look into making the providers thread safe because that keeps the API
>>simple and easier to use for the clients. Easier to use usually means less
>>buggy client code which is good :) It *might* make the provider a bit
>>harder but I hope the cleaner/easier API should out weight the more complex
>>code.
>>
>>
>>>If that is the only limitation, that is absolutely fine for me.
>>
>>It's not a big requirement, but it might still be a hard one if there is an
>>issue. The core API is really simple and should indeed be pretty much
>>thread safe, but the providers might not be as they run processes etc which
>>they might have to keep track on over time etc.
>>
>>--
>>Trygve
> 
> 
> 
> 
> 


RE: Is scm-maven thread safe?

Posted by Trygve Laugstøl <tr...@inamo.no>.
On Tue, 2006-04-11 at 14:57, Zsolt wrote:
> I gladly add new functionality or providers to the API but I would be
> definitely not the right person to make such modifications in the core API.

Oh, I think you do after all the time you've spend looking into the core by now :) I promise that if you look into the core, find any isses and create a patch I will take a look into the patches and apply them if they're good.

> Can somebody make some suggestions? I really have to make a decision:
> maven-scm or not.

It's up to you to select Maven SCM or not, but I agree with the arguments that Emmanuel had.

> Our internal API supports cvs, svn, vss, pvcs and cm-synergy but maven-scm
> has much more functionally thus I would love to replace our API but I need a
> solution that can be used in a environment with lot of parallel users.

It is definitely possible to get that going with Maven SCM, at least it would be easier to add that feature to Maven SCM that to re-implement Maven in your code.

Remember that you can always start using Maven SCM's API and then later change (or even re-implement) the providers. You are under no obligation to give the code back (although we would love it! See also Emmanuel's answer)

--
Trygve


RE: Is scm-maven thread safe?

Posted by Zsolt <zk...@intland.com>.
I gladly add new functionality or providers to the API but I would be
definitely not the right person to make such modifications in the core API.

Can somebody make some suggestions? I really have to make a decision:
maven-scm or not.

Our internal API supports cvs, svn, vss, pvcs and cm-synergy but maven-scm
has much more functionally thus I would love to replace our API but I need a
solution that can be used in a environment with lot of parallel users.

Zsolt

>-----Original Message-----
>From: Trygve Laugstøl [mailto:trygvis@apache.org]
>Sent: Tuesday, April 11, 2006 2:23 PM
>To: scm-users@maven.apache.org
>Subject: RE: Is scm-maven thread safe?
>
>On Tue, 2006-04-11 at 14:07, Zsolt wrote:
>> I have viewed a lot of maven-scm source code (but not maven core) and
>find
>> the structure clean and I didn't see anything I would consider this API
>as
>> NOT thread safe.
>>
>> But it is very important to know from beginning what is NOT thread safe.
>I
>> understand that also this API has probably bugs (like our software) but I
>> need more understanding the multi thread problems we can have or how they
>> can be prevented (I'm sure you understand, that sometime it is really
>hard
>> to reproduce and fix a multi-thread related bug).
>>
>> As I described below serialization of the request is not an option
>because
>> one user can checkout and a second view resource history the same time.
>>
>> Trygve, if I understand you correctly I should somehow assure that I
>create
>> a new provider instance for each request.
>
>Either that or ensure that all of the providers are thread safe.
>
>> I don't know how to do that but think it must be simple.
>
>It boils down to either making the providers have this stanza in
>components.xml:
>
>  <instatiation-strategy>per-lookup</instatiation-strategy>
>
>and then have _each client return the instance_ back to the container so
>that all requirements can be properly released.
>
>The alternative is to make the providers thread safe too which might not be
>too hard, and the API would be easier to use for the client.
>
>I'm not entirely sure what the best way is but I would suggest that one
>look into making the providers thread safe because that keeps the API
>simple and easier to use for the clients. Easier to use usually means less
>buggy client code which is good :) It *might* make the provider a bit
>harder but I hope the cleaner/easier API should out weight the more complex
>code.
>
>> If that is the only limitation, that is absolutely fine for me.
>
>It's not a big requirement, but it might still be a hard one if there is an
>issue. The core API is really simple and should indeed be pretty much
>thread safe, but the providers might not be as they run processes etc which
>they might have to keep track on over time etc.
>
>--
>Trygve


RE: Is scm-maven thread safe?

Posted by Trygve Laugstøl <tr...@apache.org>.
On Tue, 2006-04-11 at 14:07, Zsolt wrote:
> I have viewed a lot of maven-scm source code (but not maven core) and find
> the structure clean and I didn't see anything I would consider this API as
> NOT thread safe.
> 
> But it is very important to know from beginning what is NOT thread safe. I
> understand that also this API has probably bugs (like our software) but I
> need more understanding the multi thread problems we can have or how they
> can be prevented (I'm sure you understand, that sometime it is really hard
> to reproduce and fix a multi-thread related bug).
> 
> As I described below serialization of the request is not an option because
> one user can checkout and a second view resource history the same time.
> 
> Trygve, if I understand you correctly I should somehow assure that I create
> a new provider instance for each request.

Either that or ensure that all of the providers are thread safe.

> I don't know how to do that but think it must be simple.

It boils down to either making the providers have this stanza in components.xml:

  <instatiation-strategy>per-lookup</instatiation-strategy>

and then have _each client return the instance_ back to the container so that all requirements can be properly released.

The alternative is to make the providers thread safe too which might not be too hard, and the API would be easier to use for the client.

I'm not entirely sure what the best way is but I would suggest that one look into making the providers thread safe because that keeps the API simple and easier to use for the clients. Easier to use usually means less buggy client code which is good :) It *might* make the provider a bit harder but I hope the cleaner/easier API should out weight the more complex code.

> If that is the only limitation, that is absolutely fine for me.

It's not a big requirement, but it might still be a hard one if there is an issue. The core API is really simple and should indeed be pretty much thread safe, but the providers might not be as they run processes etc which they might have to keep track on over time etc.

--
Trygve


RE: Is scm-maven thread safe?

Posted by Zsolt <zk...@intland.com>.
I have viewed a lot of maven-scm source code (but not maven core) and find
the structure clean and I didn't see anything I would consider this API as
NOT thread safe.

But it is very important to know from beginning what is NOT thread safe. I
understand that also this API has probably bugs (like our software) but I
need more understanding the multi thread problems we can have or how they
can be prevented (I'm sure you understand, that sometime it is really hard
to reproduce and fix a multi-thread related bug).

As I described below serialization of the request is not an option because
one user can checkout and a second view resource history the same time.

Trygve, if I understand you correctly I should somehow assure that I create
a new provider instance for each request.

I don't know how to do that but think it must be simple.

If that is the only limitation, that is absolutely fine for me.

Zsolt


>-----Original Message-----
>From: Trygve Laugstøl [mailto:trygvis@apache.org]
>Sent: Tuesday, April 11, 2006 1:33 PM
>To: scm-users@maven.apache.org
>Subject: RE: Is scm-maven thread safe?
>
>On Tue, 2006-04-11 at 12:10, Zsolt wrote:
>> Trygve,
>>
>> Are you sure? In this case maven-scm is not an option for us. After
>spending
>> some days on maven-scm and implementing ScmProvider.listTask I really
>like
>> this API and even plan to add CM-Synergy support, but we are going to use
>> this API from servlets, thus it must be thread safe. You might know
>> javaforge.com that is based on our software with hundreds of projects and
>> thousands of users. Serializing the request is just not acceptable for us
>> (for the users) because it is very probably that more than one user want
>to
>> browse repositories.
>
>If something isn't thread safe just means that you'll have to use more
>instances of the thing in question.
>
>But, if this is something that's really important it wouldn't be hard to
>ensure (and keep) the core thread safe, and if the providers are used on a
>per lookup-basis you should be home safe. For all I know the core is
>practically thread safe already.
>
>I think the solution I've outlined above is the easiest solution (keeping
>the core thread safe, and just instantiate the providers per usage. The
>biggest issue with this is that the user of the provider will have to
>return/dispose the instance once it's done with it.
>
>--
>Trygve


RE: Is scm-maven thread safe?

Posted by Trygve Laugstøl <tr...@apache.org>.
On Tue, 2006-04-11 at 12:10, Zsolt wrote:
> Trygve,
> 
> Are you sure? In this case maven-scm is not an option for us. After spending
> some days on maven-scm and implementing ScmProvider.listTask I really like
> this API and even plan to add CM-Synergy support, but we are going to use
> this API from servlets, thus it must be thread safe. You might know
> javaforge.com that is based on our software with hundreds of projects and
> thousands of users. Serializing the request is just not acceptable for us
> (for the users) because it is very probably that more than one user want to
> browse repositories.

If something isn't thread safe just means that you'll have to use more instances of the thing in question.

But, if this is something that's really important it wouldn't be hard to ensure (and keep) the core thread safe, and if the providers are used on a per lookup-basis you should be home safe. For all I know the core is practically thread safe already.

I think the solution I've outlined above is the easiest solution (keeping the core thread safe, and just instantiate the providers per usage. The biggest issue with this is that the user of the provider will have to return/dispose the instance once it's done with it.

--
Trygve


RE: Is scm-maven thread safe?

Posted by Zsolt <zk...@intland.com>.
Trygve,

Are you sure? In this case maven-scm is not an option for us. After spending
some days on maven-scm and implementing ScmProvider.listTask I really like
this API and even plan to add CM-Synergy support, but we are going to use
this API from servlets, thus it must be thread safe. You might know
javaforge.com that is based on our software with hundreds of projects and
thousands of users. Serializing the request is just not acceptable for us
(for the users) because it is very probably that more than one user want to
browse repositories.

Zsolt

>-----Original Message-----
>From: Trygve Laugstøl [mailto:trygvis@apache.org]
>Sent: Tuesday, April 11, 2006 9:58 AM
>To: scm-users@maven.apache.org
>Subject: Re: Is scm-maven thread safe?
>
>On Tue, 2006-04-11 at 07:38, Zsolt wrote:
>> Hi,
>>
>> we plan to use scm-maven from tomcat. Are scm-maven and maven thread
>safe?
>
>The short answer is: no. Maven SCM is not thread safe, most of Maven
>*should* be, but there's no real guarantee for that. In particular the
>plug-ins might not be thread safe.
>
>If you want to embed Maven SCM and/or Maven itself I would recommend that
>you write a simple thread that takes commands from a servlet/jsp/web action
>and builds stuff in a serial ordering.
>
>Continuum does this all over the place so you can take a look at how it
>does the queuing and execution.
>
>--
>Trygve


Re: Is scm-maven thread safe?

Posted by Trygve Laugstøl <tr...@apache.org>.
On Tue, 2006-04-11 at 07:38, Zsolt wrote: 
> Hi,
> 
> we plan to use scm-maven from tomcat. Are scm-maven and maven thread safe?

The short answer is: no. Maven SCM is not thread safe, most of Maven *should* be, but there's no real guarantee for that. In particular the plug-ins might not be thread safe.

If you want to embed Maven SCM and/or Maven itself I would recommend that you write a simple thread that takes commands from a servlet/jsp/web action and builds stuff in a serial ordering.

Continuum does this all over the place so you can take a look at how it does the queuing and execution.

--
Trygve