Alex, For something like that you may just want to directly use one of the Lucene lock classes to create a lock:
http://search-lucene.com/?q=lock&fc_project=Lucene&fc_type=source+code e.g. http://search-lucene.com/c/Lucene:/src/java/org/apache/lucene/store/SingleInstanceLockFactory.java||makeLock Otis ---- Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch Lucene ecosystem search :: http://search-lucene.com/ ----- Original Message ---- > From: Alexander Rothenberg <a.rothenb...@fotofinder.net> > To: solr-user@lucene.apache.org > Sent: Fri, June 18, 2010 5:28:53 AM > Subject: How to LOCK the index-dir for changes from the IndexWriter > > Hi, im writing a RequestHandler that manages backups of the index-directory. > Yea, i know theres already the Replication-RequestHandler that is also > capable of creating backups, but i want the backupprocess to do some more > action and not to depend on index-commit-points as the ReplicationHandler > does. Reason is, we are running a custom DataImportHandler that starts a > full-import with the option clean=false every 30 secs (That means, its doing > changes to the current index every 30 secs). Also the importer-process never > sends a commit (bacuse that made the whole server stuck for a few secs). > So, i simply want to lock the index-directory with the same mechanism > that is used when the index gets optimized. I took a look to > DirectUpdateHandler2 / IndexWriter etc to find out what kind of lock is used > but was not successful in implementing it to my RequestHandler :( The > big advantage of locking the index-dir would be that i dont have to stop the > index-updating process. the import would automatically hold on until the > lock is removed and the backup got finished. Regards, > Alex -- Alexander Rothenberg Fotofinder GmbH > USt-IdNr. DE812854514 Software > Entwicklung Web: > target=_blank >http://www.fotofinder.net/ Potsdamer Str. > 96 Tel: +49 30 25792890 10785 Berlin > Fax: +49 30 > 257928999 Geschäftsführer: Ali > Paczensky Amtsgericht: Berlin > Charlottenburg (HRB 73099) Sitz: > Berlin