Project

General

Profile

Revision 7802

Added by Jing Tao almost 8 years ago

Log the timed index jobs.

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/SolrIndex.java
406 406
                    try {
407 407
                        EventlogFactory.createIndexEventLog().write(event);
408 408
                    } catch (Exception e) {
409
                        log.error("SolrIndex.insertToIndex - IndexEventLog can't insert the solr doc to the solr server :"+e.getMessage());
409
                        log.error("SolrIndex.insertToIndex - IndexEventLog can't log the index inserting event :"+e.getMessage());
410 410
                    }
411 411
                } catch (SolrServerException e) {
412 412
                    event.setType(IndexEvent.FAILUREINSERT);
......
414 414
                    try {
415 415
                        EventlogFactory.createIndexEventLog().write(event);
416 416
                    } catch (Exception ee) {
417
                        log.error("SolrIndex.insertToIndex - IndexEventLog can't insert the solr doc to the solr server :"+ee.getMessage());
417
                        log.error("SolrIndex.insertToIndex - IndexEventLog can't log the index inserting event :"+ee.getMessage());
418 418
                    }
419 419
                    throw e;
420 420
                } catch (IOException e) {
......
423 423
                    try {
424 424
                        EventlogFactory.createIndexEventLog().write(event);
425 425
                    } catch (Exception ee) {
426
                        log.error("SolrIndex.insertToIndex - IndexEventLog can't insert the solr doc to the solr server :"+ee.getMessage());
426
                        log.error("SolrIndex.insertToIndex - IndexEventLog can't log the index inserting event :"+ee.getMessage());
427 427
                    }
428 428
                    throw e;
429 429
                    
......
637 637
                try {
638 638
                    EventlogFactory.createIndexEventLog().write(event);
639 639
                } catch (Exception e) {
640
                    log.error("SolrIndex.removeFromIndex - IndexEventLog can't insert the solr doc to the solr server :"+e.getMessage());
640
                    log.error("SolrIndex.removeFromIndex - IndexEventLog can't log the index deleting event :"+e.getMessage());
641 641
                }
642 642
            } catch (SolrServerException e) {
643 643
                event.setType(IndexEvent.FAILUREDELETE);
......
645 645
                try {
646 646
                    EventlogFactory.createIndexEventLog().write(event);
647 647
                } catch (Exception ee) {
648
                    log.error("SolrIndex.removeFromIndex - IndexEventLog can't insert the solr doc to the solr server :"+ee.getMessage());
648
                    log.error("SolrIndex.removeFromIndex - IndexEventLog can't log the index deleting event :"+ee.getMessage());
649 649
                }
650 650
                throw e;
651 651
                
......
655 655
                try {
656 656
                    EventlogFactory.createIndexEventLog().write(event);
657 657
                } catch (Exception ee) {
658
                    log.error("SolrIndex.removeFromIndex - IndexEventLog can't insert the solr doc to the solr server :"+ee.getMessage());
658
                    log.error("SolrIndex.removeFromIndex - IndexEventLog can't log the index deleting event :"+ee.getMessage());
659 659
                }
660 660
                throw e;
661 661
            }
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/IndexGenerator.java
30 30
import java.io.FileNotFoundException;
31 31
import java.io.InputStream;
32 32
import java.util.ArrayList;
33
import java.util.Calendar;
33 34
import java.util.Date;
34 35
import java.util.List;
35 36
import java.util.TimerTask;
......
54 55
import com.hazelcast.core.IMap;
55 56
import com.hazelcast.core.ISet;
56 57

  
58
import edu.ucsb.nceas.metacat.index.event.EventlogFactory;
59
import edu.ucsb.nceas.metacat.index.event.IndexEvent;
57 60

  
61

  
58 62
/**
59 63
 * A class represents the object to generate massive solr indexes.
60 64
 * This can happen during an update of Metacat (generating index for all existing documents)
......
216 220
    }
217 221
    
218 222
    public void run() {
223
        IndexEvent event = new IndexEvent();
224
        event.setDate(Calendar.getInstance().getTime());
225
        event.setType(IndexEvent.STARTTIMEDINDEX);
226
        event.setDescription("Start the timed index job");
219 227
        try {
228
            EventlogFactory.createIndexEventLog().write(event);
229
        } catch (Exception e) {
230
            log.error("IndexGenerator.run - IndexEventLog can't log the timed indexing start event :"+e.getMessage());
231
        }
232
        try {
233
            
220 234
            indexAll();
221 235
        } catch (InvalidRequest e) {
222 236
            // TODO Auto-generated catch block
......
244 258
        } catch (FileNotFoundException e) {
245 259
            log.error("IndexGenerator.run - Metadata-Index couldn't generate indexes for those documents which haven't been indexed : "+e.getMessage());
246 260
        }
261
        event.setDate(Calendar.getInstance().getTime());
262
        event.setType(IndexEvent.FINISHTIMEDINDEX);
263
        event.setDescription("Finish the timed index job");
264
        try {
265
            EventlogFactory.createIndexEventLog().write(event);
266
        } catch (Exception e) {
267
            log.error("IndexGenerator.run - IndexEventLog can't log the timed indexing finish event :"+e.getMessage());
268
        }
247 269
    }
248 270
    
249 271
    /*

Also available in: Unified diff