Hi Uwe, Yes we have completely custom directory implementation, but anyway we have not hardcoded the lock factory. But simply we are passing SingleInstanceLockFactory with the constructor. I have implemented the makeLock. I see some additional methods like renameFile..etc. I ll update you once we implement all necessary methods. Thanks a lot for your explanation!
On Thu, May 21, 2015 at 10:50 PM, Uwe Schindler <u...@thetaphi.de> wrote: > Hi, > > LockFactories are singletons in Lucene. Basically a directory does not > even need a LockFactory, the LockFactories are just there to allow > "configuring" it in FSDirectory subclasses. The abstract BaseDirectory > class handles this for you, as it delegates all calls to the Directory to a > given lock factory (this method is final). In your lock factory (ideally > also a singleton) the method makeLock is where the lock instance should be > created and returned based on the directory instance passed in. This lock > instance is responsible to actually lock the directory and also to release > the lock. There is no need to forcefully unlock, if you make sure that your > code calls Lock#release() in a finally block. > > If you have a completely custom directory implementation with a > hard-coded, non configureable locking mechanism, it makes no sense to > extend BaseDirectory, just extend Directory and implement the abstract > method makeLock(). This method is responsible for creating the lock > instance that handles actual locking und unlocking. Alternatively you can > just hardcode SingleInstanceLockFactory (like RAMDirectory does). > > clearLock is no longer existent, because it was never used in Lucene. It > was there to forcefully remove a lock, which is a bad idea. The only > available method is, as said before, Directory#makeLock that should return > a Lock instance. > > Uwe > > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: u...@thetaphi.de > > > > -----Original Message----- > > From: Gimantha Bandara [mailto:giman...@wso2.com] > > Sent: Thursday, May 21, 2015 3:12 PM > > To: java-user@lucene.apache.org > > Subject: Migrating from Lucene 4.10.3 to Lucene 5.10 > > > > Hi all, > > I was going to through > > https://lucene.apache.org/core/5_1_0/MIGRATE.html > > It is said that the Directory and LockFactory are now refactored. > > We have implemented custom directory implementation with > > SingleInstanceLockFactory. In Lucene 4.10.3 we have clearLock method. > But I > > dont find it in 5.1.0. How does Lucene 5.1.0 handle releasing the lock? > > > > -- > > Gimantha Bandara > > Software Engineer > > WSO2. Inc : http://wso2.com > > Mobile : +94714961919 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > -- Gimantha Bandara Software Engineer WSO2. Inc : http://wso2.com Mobile : +94714961919