You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2003/07/26 17:44:43 UTC

[lang] StringUtils thread safety

I have changed the padding() method in StringUtils.

The original version was definitely thread-unsafe, as two threads could have
competed to update the static at the same time.

The new version is PROBABLY thread safe. It doesn't synchronize, but does
rely on atomic read and write into an array element. Now I know read/write
of a simple object IS atomic, but I don't know about an array element.

// assumed to be atomic read:
String pad = PADDING[ch];
// assumed to be atomic write:
PADDING[ch] = pad;

So, any thread expects out there???

Stephen


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [lang] commons-lang-SNAPSHOT on maven/ibiblio

Posted by Henri Yandell <ba...@generationjava.com>.

On Mon, 28 Jul 2003, Michael Heuer wrote:

>
> On Mon, 28 Jul 2003, Joe Germuska wrote:
>
> > At 18:52 -0400 7/28/03, Henri Yandell wrote:
> > >
> > >Afaik, the SNAPSHOT jar is not something we put there.
> > >
> > >There's a nightly build that you can download and put in your own maven
> > >repository. Alternatively, the Maven guys could suck those nightly builds
> > >over for each Jakarta nightly build.
> >
> > It probably doesn't make sense for Maven or iBiblio administrators to
> > try to keep up with nightly builds -- someone who uses Maven should
> > find it quite easy to install a newer snapshot of a Commons package
> > from CVS -- just go to the root directory of the commons project and
> > type "maven jar:install-snapshot"
>
> I did this with commons-lang and created jars
>
> 192535 Feb 11 10:24 commons-lang-20030203.000129.jar
> 189322 Jul 28 21:16 commons-lang-20030729.021523.jar
> 189322 Jul 28 21:16 commons-lang-SNAPSHOT.jar
>
> in the repository.
>
> My project.xml contains a dependency <id>commons-lang</id>
> <version>SNAPSHOT</version>.  If I build my project, maven re-downloads
> the 11 Feb SNAPSHOT from ibiblio and overwrites the -SNAPSHOT jar in the
> repository
>
> 192535 Feb 11 10:24 commons-lang-20030203.000129.jar
> 189322 Jul 28 21:16 commons-lang-20030729.021523.jar
> 192535 Jul 28 21:18 commons-lang-SNAPSHOT.jar
>
> and in my case, then fails to compile.  Am I missing something?

Nope. The only solutions I can think of are:

1) Remove SNAPSHOTs from the central Maven repo.
2) Setup your own repo in front of the maven repo [using
project.properties] so that your SNAPSHOT wins.
3) Depend on a version, '20030729.021523'.

I'm increasingly in favour of 1), especially with this example of how it
can bite.

Hen


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [lang] commons-lang-SNAPSHOT on maven/ibiblio

Posted by Michael Heuer <he...@acm.org>.
On Mon, 28 Jul 2003, Joe Germuska wrote:

> At 18:52 -0400 7/28/03, Henri Yandell wrote:
> >
> >Afaik, the SNAPSHOT jar is not something we put there.
> >
> >There's a nightly build that you can download and put in your own maven
> >repository. Alternatively, the Maven guys could suck those nightly builds
> >over for each Jakarta nightly build.
>
> It probably doesn't make sense for Maven or iBiblio administrators to
> try to keep up with nightly builds -- someone who uses Maven should
> find it quite easy to install a newer snapshot of a Commons package
> from CVS -- just go to the root directory of the commons project and
> type "maven jar:install-snapshot"

I did this with commons-lang and created jars

192535 Feb 11 10:24 commons-lang-20030203.000129.jar
189322 Jul 28 21:16 commons-lang-20030729.021523.jar
189322 Jul 28 21:16 commons-lang-SNAPSHOT.jar

in the repository.

My project.xml contains a dependency <id>commons-lang</id>
<version>SNAPSHOT</version>.  If I build my project, maven re-downloads
the 11 Feb SNAPSHOT from ibiblio and overwrites the -SNAPSHOT jar in the
repository

192535 Feb 11 10:24 commons-lang-20030203.000129.jar
189322 Jul 28 21:16 commons-lang-20030729.021523.jar
192535 Jul 28 21:18 commons-lang-SNAPSHOT.jar

and in my case, then fails to compile.  Am I missing something?

   thanks
   michael


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [lang] commons-lang-SNAPSHOT on maven/ibiblio

Posted by Joe Germuska <Jo...@Germuska.com>.
At 18:52 -0400 7/28/03, Henri Yandell wrote:
>
>Afaik, the SNAPSHOT jar is not something we put there.
>
>There's a nightly build that you can download and put in your own maven
>repository. Alternatively, the Maven guys could suck those nightly builds
>over for each Jakarta nightly build.

It probably doesn't make sense for Maven or iBiblio administrators to 
try to keep up with nightly builds -- someone who uses Maven should 
find it quite easy to install a newer snapshot of a Commons package 
from CVS -- just go to the root directory of the commons project and 
type "maven jar:install-snapshot"

If you work with a team who need to share a newer snapshot, and 
getting them all to install snapshots the same way is too much 
trouble, then you can set up a local repository anywhere you can run 
a web server.  To have your project consult more than one repository, 
set the property "maven.repo.remote" to a comma-delimited list of 
repository root URLs -- and don't forget to include 
"http://www.ibiblio.org/
maven" because if you set the property, the default behavior of 
checking that site is disabled.

If you can set up SSH or NFS on that server, you can use "maven 
jar:deploy-snapshot" to get a copy of the JAR someplace where 
everyone can share it.   For SSH, set the properties 
maven.repo.central (to the repository host) and 
maven.repo.central.directory (to the path to the repository root on 
the host).  I don't know the properties to set to control NFS, but 
it's documented on the Maven site.

Hope that helps.

Joe

-- 
--
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"If nature worked that way, the universe would crash all the time." 
	--Jaron Lanier

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [lang] commons-lang-SNAPSHOT on maven/ibiblio

Posted by Henri Yandell <ba...@generationjava.com>.
Afaik, the SNAPSHOT jar is not something we put there.

There's a nightly build that you can download and put in your own maven
repository. Alternatively, the Maven guys could suck those nightly builds
over for each Jakarta nightly build.

Hen

On Mon, 28 Jul 2003, Michael Heuer wrote:

> Hello,
>
> As version 2.0 nears completion, would it be possible to update the
> commons-lang-SNAPSHOT jar on ibiblio?  The current one has a timestamp
> from February.
>
>    michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[lang] commons-lang-SNAPSHOT on maven/ibiblio

Posted by Michael Heuer <he...@acm.org>.
Hello,

As version 2.0 nears completion, would it be possible to update the
commons-lang-SNAPSHOT jar on ibiblio?  The current one has a timestamp
from February.

   michael


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org