KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > business > search > operations > WriteToIndexOperation


1 /*
2  * Created on Aug 12, 2003
3  *
4  * To change the template for this generated file go to
5  * Window>Preferences>Java>Code Generation>Code and Comments
6  */

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 /**
14  * @author aim4min
15  *
16  * To change the template for this generated type comment go to
17  * Window>Preferences>Java>Code Generation>Code and Comments
18  */

19 public abstract class WriteToIndexOperation extends IndexOperation {
20
21     /**
22      * @param manager
23      */

24     public WriteToIndexOperation(IndexManagerImpl mgr)
25     {
26         super(mgr);
27     }
28
29     private static Log mLogger =
30         LogFactory.getFactory().getInstance(WriteToIndexOperation.class);
31           
32     /* (non-Javadoc)
33      * @see java.lang.Runnable#run()
34      */

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 JavaDoc 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