Index: src/edu/ucsb/nceas/metacat/DBSAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBSAXHandler.java	(revision 2729)
+++ src/edu/ucsb/nceas/metacat/DBSAXHandler.java	(revision 2730)
@@ -54,7 +54,7 @@
  * call when processing the XML stream and generating events.
  */
 public class DBSAXHandler extends DefaultHandler implements LexicalHandler,
-        DeclHandler, Runnable
+        DeclHandler
 {
 
     protected boolean atFirstElement;
@@ -97,8 +97,6 @@
 
     protected String pub = null;
 
-    protected Thread xmlIndex;
-
     private boolean endDocument = false;
 
     protected int serverCode = 1;
@@ -116,7 +114,6 @@
     protected static final int MAXDATACHARS = 4000;
 
     //protected static final int MAXDATACHARS = 50;
-    protected static final long INDEXDELAY = 10000;
 
     // methods writeChildNodeToDB, setAttribute, setNamespace,
     // writeTextForDBSAXNode will increase endNodeId.
@@ -215,7 +212,6 @@
         this.groups = groups;
         this.pub = pub;
         this.serverCode = serverCode;
-        this.xmlIndex = new Thread(this);
     }
 
     /** SAX Handler that receives notification of beginning of the document */
@@ -440,117 +436,8 @@
             hasTriple = true;
             currentTriple = new Triple();
         }
-    }
+    }    
 
-    public void runIndexingThread(){
-    	
-        boolean useXMLIndex =
-            (new Boolean(MetaCatUtil.getOption("usexmlindex"))).booleanValue();
-        if (useXMLIndex && !isRevisionDoc) {
-            try {
-                xmlIndex.start();
-            } catch (NullPointerException e) {
-                xmlIndex = null;
-                logMetacat.error("Error in DBSAXHandler.runIndexingThread() "
-                        + e.getMessage());
-            }
-        }
-    }
-    
-    /*
-     * Run a separate thread to build the XML index for this document.  This
-     * thread is run asynchronously in order to more quickly return control to
-     * the submitting user.  The run method checks to see if the document has
-     * been fully inserted before trying to update the xml_index table.
-     */
-    public void run()
-    {
-        try {
-            if (!isRevisionDoc)
-            {
-             // stop 5 second
-             Thread.sleep(5000);
-             //make sure record is done
-             checkDocumentTable();
-             // Build the index for this document
-             currentDocument.buildIndex();
-            }
-        } catch (Exception e) {
-            logMetacat.error("Error in DBSAXHandler.run "
-                    + e.getMessage());
-        }
-    }
-
-    /*
-     * method to make sure insert is finished before create index table If new
-     * version of record is in xml_documents every thing will be fine
-     */
-    private void checkDocumentTable() throws Exception
-    {
-
-        DBConnection dbConn = null;
-        int serialNumber = -1;
-
-        try {
-            // Opening separate db connection for writing XML Index
-            dbConn = DBConnectionPool
-                    .getDBConnection("DBSAXHandler.checkDocumentTable");
-            serialNumber = dbConn.getCheckOutSerialNumber();
-
-            // the following while loop construct checks to make sure that
-            // the docid of the document that we are trying to index is already
-            // in the xml_documents table. if this is not the case, the foreign
-            // key relationship between xml_documents and xml_index is
-            // temporarily broken causing multiple problems.
-            boolean inxmldoc = false;
-            long startTime = System.currentTimeMillis();
-            while (!inxmldoc) {
-                String xmlDocumentsCheck = "select distinct docid from xml_documents"
-                        + " where docid ='"
-                        + docid
-                        + "' and "
-                        + " rev ='"
-                        + revision + "'";
-
-                PreparedStatement xmlDocCheck = dbConn
-                        .prepareStatement(xmlDocumentsCheck);
-                // Increase usage count
-                dbConn.increaseUsageCount(1);
-                xmlDocCheck.execute();
-                ResultSet doccheckRS = xmlDocCheck.getResultSet();
-                boolean tableHasRows = doccheckRS.next();
-                if (tableHasRows) {
-                    logMetacat.info(
-                            "=========== found the correct document");
-                    inxmldoc = true;
-                }
-                doccheckRS.close();
-                xmlDocCheck.close();
-                // make sure the while loop will be ended in reseaonable time
-                long stopTime = System.currentTimeMillis();
-                if ((stopTime - startTime) > INDEXDELAY) { 
-                  	logMetacat.warn("Couldn't find the docid for index build in "
-                            + "reseaonable time!");
-                	throw new Exception(
-                        "Couldn't find the docid for index build in "
-                                + "reseaonable time!"); 
-                }
-            }//while
-        } catch (Exception e) {
-            try {
-                dbConn.rollback();
-                //dbconn.close();
-            } catch (SQLException sqle) {
-            }
-            logMetacat.error("Error in DBSAXHandler.checkDocumentTable "
-                    + e.getMessage());
-
-        } finally {
-            DBConnectionPool.returnDBConnection(dbConn, serialNumber);
-        }//finally
-
-    }
-
     /** SAX Handler that is called for each XML text node */
     public void characters(char[] cbuf, int start, int len) throws SAXException
     {
