Re: Extending SimpleWebDavServlet

2008-09-29 Thread Marc Speck
Very interesting, thanks for the feedback! Let me see whether I got it: 1. All statements below refer to Java 1.5. 2. fieldX = new SomeType(zzz) - This is thread-safe if SomeType is immutable. An immutable object features: - unmodifiable state - all fields are final and all fields hold immuta

Re: Extending SimpleWebDavServlet

2008-09-29 Thread Marcel Reutegger
Connor, Brett (LNG-TWY) wrote: > But there a situation where one thread can be using one locator factory and > another thread using a different one isn't there? correct, but AFAIU that's not an issue in this case. the locator factory does not have to be a singleton in a strict sense. regards mar

RE: Extending SimpleWebDavServlet

2008-09-29 Thread Connor, Brett (LNG-TWY)
Marcel wrote: > > Marc Speck wrote: > > Actually, this internal field is the source of a potential data race: > > thread A runs up to the point, when it has constructed > > LocatorFactoryImplEx but has not yet assigned the internal field. > > Thread A gets on hold relative to thread B. B runs t

RE: Extending SimpleWebDavServlet

2008-09-29 Thread Connor, Brett (LNG-TWY)
Marc wrote: > > Hi Felix > > > I am neither an export on any Memory Model issue, but I always thought > > that the construct > > > > fieldX = new SomeType(zzz); > > > > would be ok, because fieldX would only be set after the SomeType > > instance has properly been setup and ready for use. >

Re: Extending SimpleWebDavServlet

2008-09-29 Thread Marcel Reutegger
Marc Speck wrote: > Actually, this internal field is the source of a potential data race: thread > A runs up to the point, when it has constructed LocatorFactoryImplEx but has > not yet assigned the internal field. Thread A gets on hold relative to > thread B. B runs through the getter and sees tha

Re: Extending SimpleWebDavServlet

2008-09-29 Thread Marc Speck
Hi Felix > I am neither an export on any Memory Model issue, but I always thought > that the construct > > fieldX = new SomeType(zzz); > > would be ok, because fieldX would only be set after the SomeType > instance has properly been setup and ready for use. I would have thought the same if

Re: Extending SimpleWebDavServlet

2008-09-29 Thread Felix Meschberger
Hi Marc, You are getting me on my left foot ;-) I am neither an export on any Memory Model issue, but I always thought that the construct fieldX = new SomeType(zzz); would be ok, because fieldX would only be set after the SomeType instance has properly been setup and ready for use. Have y

Re: Extending SimpleWebDavServlet

2008-09-28 Thread Marc Speck
Thanks for the replies, Alex and Felix. > The original author is > currently on vacation, maybe she can answer you later. > Sure, I've just done the same. Before giving my reply, I want to emphasize that I'm on thin ice when talking about memory model in Java 1.5 let alone 1.4 that Jackrabbit r

Re: Extending SimpleWebDavServlet

2008-09-10 Thread Felix Meschberger
Hi Marc, Marc Speck schrieb: > Ok, everybody seems to silently agree that there is no threading issue with > this servlet method: > > public DavLocatorFactory getLocatorFactory() { > if (locatorFactory == null) { > locatorFactory = new LocatorFactoryImplEx(resourcePathPrefix); > }

Re: Extending SimpleWebDavServlet

2008-09-07 Thread Alexander Klimetschek
Factory = new LocatorFactoryImplEx(resourcePathPrefix); >} >return locatorFactory; > } > > > I just ask why this is thread safe. It is not called in servlet.init() or > the like, isn't it? > Thanks, > Marc > > > > > On Tue, Sep 2, 2008 at 8:55 AM, Marc Speck

Re: Extending SimpleWebDavServlet

2008-09-05 Thread Marc Speck
why this is thread safe. It is not called in servlet.init() or the like, isn't it? Thanks, Marc On Tue, Sep 2, 2008 at 8:55 AM, Marc Speck <[EMAIL PROTECTED]> wrote: > > While extending SimpleWebDavServlet, I could not see at first glance how getLocatorFactory() ( http://fishe

Extending SimpleWebDavServlet

2008-09-01 Thread Marc Speck
While extending SimpleWebDavServlet, I could not see at first glance how getLocatorFactory() ( http://fisheye6.atlassian.com/browse/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java?r=603178#l204) is called the first time (for lazy