Project

General

Profile

« Previous | Next » 

Revision 2580

Added by sgarg about 19 years ago

Fix for bug 2060.

Moved the call to starting of indexing thread from endDocument to DocumentImpl after commit has been done. This way when ever a document is indexed it has already been entered in xml_nodes and xml_documents

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
2102 2102
                    parser.parse(new InputSource(xml));
2103 2103
                    conn.commit();
2104 2104
                    conn.setAutoCommit(true);
2105

  
2106
                    DBSAXHandler dbx = (DBSAXHandler) parser.getContentHandler();
2107
                    dbx.runIndexingThread();
2105 2108
                } catch (Exception e) {
2106 2109
                    conn.rollback();
2107 2110
                    conn.setAutoCommit(true);
src/edu/ucsb/nceas/metacat/DBSAXHandler.java
242 242
                                + e.getMessage());
243 243
            }
244 244
        }
245
        boolean useXMLIndex =
246
            (new Boolean(MetaCatUtil.getOption("usexmlindex"))).booleanValue();
247
        if (useXMLIndex) {
248
            try {
249
                xmlIndex.start();
250
            } catch (NullPointerException e) {
251
                xmlIndex = null;
252
                throw new SAXException(
253
                        "Problem with starting thread for writing XML Index. "
254
                                + e.getMessage());
255
            }
256
        }
257 245
    }
258 246

  
259 247
    /** SAX Handler that is called at the start of Namespace */
......
427 415
        }
428 416
    }
429 417

  
418
    public void runIndexingThread(){
419
        boolean useXMLIndex =
420
            (new Boolean(MetaCatUtil.getOption("usexmlindex"))).booleanValue();
421
        if (useXMLIndex) {
422
            try {
423
                xmlIndex.start();
424
            } catch (NullPointerException e) {
425
                xmlIndex = null;
426
                MetaCatUtil.debugMessage("Error in DBSAXHandler.runIndexingThread() "
427
                        + e.getMessage(), 20);
428
            }
429
        }
430
    }
431
    
430 432
    /*
431 433
     * Run a separate thread to build the XML index for this document.  This
432 434
     * thread is run asynchronously in order to more quickly return control to
......
488 490
                boolean tableHasRows = doccheckRS.next();
489 491
                if (tableHasRows) {
490 492
                    MetaCatUtil.debugMessage(
491
                            "=========== find the correct document", 35);
493
                            "=========== found the correct document", 35);
492 494
                    inxmldoc = true;
493 495
                }
494 496
                doccheckRS.close();

Also available in: Unified diff