| 1 41 package com.mvnforum.search.post; 42 43 import java.util.TimerTask ; 44 45 import org.apache.commons.logging.Log; 46 import org.apache.commons.logging.LogFactory; 47 48 public class DeletePostIndexTask extends TimerTask  50 { 51 private static Log log = LogFactory.getLog(DeletePostIndexTask.class); 52 53 public static final int OBJECT_TYPE_POST = 0; 55 public static final int OBJECT_TYPE_THREAD = 1; 56 public static final int OBJECT_TYPE_FORUM = 2; 57 58 private int objectID; 59 private int objectType; 60 61 64 DeletePostIndexTask(int objectID, int objectType) { 65 this.objectID = objectID; 66 this.objectType = objectType; 67 } 68 69 public void run() { 70 log.debug("DeletePostIndexTask.run : objectID = " + objectID + " with objectType = " + objectType); 71 try { 72 switch (objectType) { 73 case OBJECT_TYPE_POST: 74 PostIndexer.deletePostFromIndex(objectID); 75 break; 76 case OBJECT_TYPE_THREAD: 77 PostIndexer.deleteThreadFromIndex(objectID); 78 break; 79 case OBJECT_TYPE_FORUM: 80 PostIndexer.deleteForumFromIndex(objectID); 81 break; 82 default: 83 log.warn("Cannot process the DeletePostIndexTask with objectID = " + objectID + " with objectType = " + objectType); 84 } 85 } catch (Exception ex) { 86 log.error("Error while performing index operation", ex); 87 } 88 } 89 } 90 91 | Popular Tags |