brianchandotcom/liferay-portal — pull request #5223 by matethurzo (2012-05-08 14:06:26+00:00)
Title: LPS-25816

Hi Brian,

I'm not sure if you remember but I've implemented the new Lucene version to the portal, and you have asked me to resolve the deprecated items around it. I've coded the way the Lucene wants us to use their library, and I've submitted the changes to Ray for review, but he is on a longer vacation. I didn't want the pull request to be forgotten, and also you have asked me to send the pull request to you directly, so I'm sending it right now.

Here are some comments on the changelist:

I've removed the optimize feature, according to the lucene teams it's extremely inefficient.

The changes are quite straightforward although there is one change I wan't to highlight. There is a bug in the JRE, this is a known bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038

Because of this bug the OS (typically Windows) cannot release the native file handler while the GC hasn't collected all the underlying objects. This means if you want to delete or overwrite a file and the OS still holds the native file handle, then it might result in an IOException. To prevent this case I've introduced some System.gc() statements - it can be switched off since most of the systems/JREs won't have problems with that. Please read the details here: http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/api/core/org/apache/lucene/store/FSDirectory.html
This has been revealed during running the IndexAccessorImplTest tests, and for me the test is running perfectly with the GC calls.

The Lucene documentation mentions at multiple places that the windows JRE implementation has multiple bugs.

Please let me know if you have any questions or concerns.

Thanks,

Máté