1 7 package org.roller.business.search.operations; 8 9 import org.apache.commons.logging.Log; 10 import org.apache.commons.logging.LogFactory; 11 import org.roller.business.IndexManagerImpl; 12 13 19 public abstract class WriteToIndexOperation extends IndexOperation { 20 21 24 public WriteToIndexOperation(IndexManagerImpl mgr) 25 { 26 super(mgr); 27 } 28 29 private static Log mLogger = 30 LogFactory.getFactory().getInstance(WriteToIndexOperation.class); 31 32 35 public void run() 36 { 37 try 38 { 39 manager.getReadWriteLock().writeLock().acquire(); 40 mLogger.info("Starting search index operation"); 41 doRun(); 42 mLogger.info("Search index operation complete"); 43 } 44 catch (InterruptedException e) 45 { 46 mLogger.error("Error acquiring write lock on index", e); 47 } 48 finally 49 { 50 manager.getReadWriteLock().writeLock().release(); 51 } 52 manager.resetSharedReader(); 53 } 54 } 55 | Popular Tags |