You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Mike Hearn <m....@signal.QinetiQ.com> on 2004/08/27 13:00:59 UTC
FSDirectory.makeLock() declared final
Hi,
I'm wondering why there are so many final methods in FSDirectory. In
particular I'd like to customize the locking behaviour and was
originally going to do that by subclassing FSDirectory and just
overriding the makeLock() method, until I noticed that it was marked final.
I can't see any obvious reason for this. The usual motivation given is
speed, but this article:
http://www-106.ibm.com/developerworks/java/library/j-jtp1029.html
... strongly implies that it doesn't make much difference at all, and
the opinion of the writer is certainly that the losses outweigh the gains.
For now I'm just going to copy/paste the FSDirectory class into my
program and customize it there. If speed is the motivation, does anybody
have benchmarks to show that it really speeds things up?
thanks -mike
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: FSDirectory.makeLock() declared final
Posted by Mike Hearn <m....@signal.QinetiQ.com>.
> I think so (besides one small error with removing the "final" from a local
> variable which I fixed). I just committed your patch.
Oops, I thought I had put all the variable finals back in. I guess I
didn't read it carefully enough.
Thanks for committing it.
-mike
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: FSDirectory.makeLock() declared final
Posted by Daniel Naber <da...@t-online.de>.
On Thursday 02 September 2004 16:21, Mike Hearn wrote:
> > You are probably likely to do this sooner than I am. Feel free.
>
> Here you go. Is it OK?
I think so (besides one small error with removing the "final" from a local
variable which I fixed). I just committed your patch.
Regards
Daniel
--
http://www.danielnaber.de
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: FSDirectory.makeLock() declared final
Posted by Mike Hearn <m....@signal.QinetiQ.com>.
> You are probably likely to do this sooner than I am. Feel free.
Here you go. Is it OK?
thanks -mike
Re: FSDirectory.makeLock() declared final
Posted by Doug Cutting <cu...@apache.org>.
Mike Hearn wrote:
>> Note too that a few of Lucene's final declarations are there because
>> classes and/or methods really should not be overridden. I don't think
>> FSDirectory falls into this category. So I support making FSDirectory
>> and its methods non-final.
>
> OK, do you want to write the patch or shall I?
You are probably likely to do this sooner than I am. Feel free.
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: FSDirectory.makeLock() declared final
Posted by Mike Hearn <m....@signal.QinetiQ.com>.
Doug Cutting wrote:
> Back in 1998, when FSDirectory was first written, 'final' did actually
> make some things faster. It permitted 'javac' to inline more things. It
> also held the promise that future compilers might do more with it. Well,
> now here we are in the future, and all we have are a bunch of final
> declarations!
>
> Note too that a few of Lucene's final declarations are there because
> classes and/or methods really should not be overridden. I don't think
> FSDirectory falls into this category. So I support making FSDirectory
> and its methods non-final.
OK, do you want to write the patch or shall I?
thanks -mike
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: FSDirectory.makeLock() declared final
Posted by Doug Cutting <cu...@apache.org>.
Mike Hearn wrote:
> I can't see any obvious reason for this. The usual motivation given is
> speed, but this article:
>
> http://www-106.ibm.com/developerworks/java/library/j-jtp1029.html
>
> ... strongly implies that it doesn't make much difference at all, and
> the opinion of the writer is certainly that the losses outweigh the gains.
Back in 1998, when FSDirectory was first written, 'final' did actually
make some things faster. It permitted 'javac' to inline more things.
It also held the promise that future compilers might do more with it.
Well, now here we are in the future, and all we have are a bunch of
final declarations!
Note too that a few of Lucene's final declarations are there because
classes and/or methods really should not be overridden. I don't think
FSDirectory falls into this category. So I support making FSDirectory
and its methods non-final.
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: FSDirectory.makeLock() declared final
Posted by Christoph Goller <go...@detego-software.de>.
Mike Hearn wrote:
> Hi,
>
> I'm wondering why there are so many final methods in FSDirectory. In
> particular I'd like to customize the locking behaviour and was
> originally going to do that by subclassing FSDirectory and just
> overriding the makeLock() method, until I noticed that it was marked final.
>
> I can't see any obvious reason for this. The usual motivation given is
> speed, but this article:
>
> http://www-106.ibm.com/developerworks/java/library/j-jtp1029.html
>
> ... strongly implies that it doesn't make much difference at all, and
> the opinion of the writer is certainly that the losses outweigh the gains.
>
> For now I'm just going to copy/paste the FSDirectory class into my
> program and customize it there. If speed is the motivation, does anybody
> have benchmarks to show that it really speeds things up?
I am sure the motivation is not speed. FSDirectory itself is final.
Since it is final one can always rely on its behaviour and on the
locking mechanism which is kind of central to Lucene.
However, I do not have very strong feelings for leaving it final.
Lets see what others think.
Christoph
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org