KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > threads > ContentReindexerThread


1 package com.dotmarketing.threads;
2
3 import com.dotmarketing.db.DbConnectionFactory;
4 import com.dotmarketing.db.DotHibernate;
5 import com.dotmarketing.portlets.contentlet.factories.ContentletFactory;
6 import com.dotmarketing.util.Logger;
7
8 public class ContentReindexerThread implements Runnable JavaDoc {
9
10     public ContentReindexerThread() {
11     }
12
13     public void run()
14     {
15         try
16         {
17             Logger.info(this, "Trying to reindex all the content");
18             if (!ContentletFactory.reIndexAllContentlets()) {
19                 Logger.info(this, "Another reindexation is in progress");
20             } else {
21                 Logger.info(this, "Reindexation is in progress");
22             }
23         }
24         catch (Exception JavaDoc e)
25         {
26             Logger.error(this, "Error ocurred trying to reindex contents.", e);
27         }
28         finally
29         {
30             DotHibernate.closeSession();
31             DbConnectionFactory.closeConnection();
32         }
33     }
34
35     /*
36      * (non-Javadoc)
37      *
38      * @see java.lang.Thread#destroy()
39      */

40     public void destroy()
41     {
42         
43     }
44 }
45
Popular Tags