Changeset 3203


Ignore:
Timestamp:
07/27/13 13:44:44 (11 years ago)
Author:
keeloo
Message:

Some more work on handling errors in the connection to the solr server. Final commit for 2.15 beta.

Location:
vlo/trunk/vlo_importer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • vlo/trunk/vlo_importer/nbactions.xml

    r2883 r3203  
    88            </goals>
    99            <properties>
    10                 <exec.args>-DconfigFile=/Users/keeloo/projects/clarin/vlo/VloConfig.xml -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter</exec.args>
     10                <exec.args>-DconfigFile=/home/keeloo/vlo/config/VloConfig.Netbeans.xml -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter</exec.args>
    1111                <exec.executable>java</exec.executable>
    1212                <exec.classpathScope>runtime</exec.classpathScope>
     
    2020            </goals>
    2121            <properties>
    22                 <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -DconfigFile=/Users/keeloo/projects/clarin/vlo/VloConfig.xml -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter</exec.args>
     22                <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -DconfigFile=/home/keeloo/vlo/config/VloConfig.Netbeans.xml -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter</exec.args>
    2323                <exec.executable>java</exec.executable>
    2424                <exec.classpathScope>runtime</exec.classpathScope>
     
    3333            </goals>
    3434            <properties>
    35                 <exec.args>${profiler.args} -DconfigFile=/Users/keeloo/projects/clarin/vlo/VloConfig.xml -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter</exec.args>
     35                <exec.args>${profiler.args} -DconfigFile=/home/keeloo/vlo/config/VloConfig.Netbeans.xml -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter</exec.args>
    3636                <exec.executable>${profiler.java}</exec.executable>
    3737            </properties>
  • vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java

    r3175 r3203  
    9696
    9797    // SOME STATS
    98     protected int nrOFDocumentsUpdated;
     98    protected int nrOFDocumentsSend;
    9999    protected int nrOfFilesAnalyzed = 0;
    100100    protected int nrOfFilesWithoutId = 0;
     
    166166        LOG.info("Found " + nrOfIgnoredFiles
    167167                + " file(s) that where ignored (files without resources or any link to a search service or landing page are ignored).");
    168         LOG.info("Update of " + nrOFDocumentsUpdated + " took " + took + " secs. Total nr of files analyzed " + nrOfFilesAnalyzed);
     168        LOG.info("Update of " + nrOFDocumentsSend + " took " + took + " secs. Total nr of files analyzed " + nrOfFilesAnalyzed);
    169169    }
    170170
     
    377377     * Send the current list of documents to the SOLR server
    378378     *
    379      * @throws SolrServerException
    380      * @throws IOException
     379     * @throws SolrServerException in case the server does not respond. Ask the
     380     * server is asked for a response after 1, 2, 4, 8 ...  seconds until the
     381     * timeout specified in the configuration file is reached.
     382     *   
     383     * @throws IOException when the waiting for another attempt to send documents
     384     * to the server is interrupted.
    381385     */
    382386    protected void sendDocs() throws SolrServerException, IOException {
     
    384388        boolean done = false;
    385389       
    386         LOG.info("Sending " + docs.size() +
    387                 " docs to solr server queue. Number of docs updated till now: "
    388                 + nrOFDocumentsUpdated);
    389 
    390         nrOFDocumentsUpdated += docs.size();
    391         // add the documents in the list to the solr queue
     390        /* Start trying, or keep trying to send documents as long as the
     391         * timeout value specified in the VloConfig.xml file has not been
     392         * reached.
     393         */
    392394        while (! done && wait <= VloConfig.getSolrTimeOut()){
    393395            solrServer.add(docs);
     
    398400                        LOG.info("Waiting 1 second for the solr server to respond");
    399401                    } else {
    400                         LOG.info("Waiting ", wait,
    401                                 "seconds for the solr server to respond");
     402                        LOG.info("Waiting " + wait +
     403                                " seconds for the solr server to respond");
    402404                    }
     405                    // wait for the accumulated amount of time
    403406                    Thread.sleep(1000 * wait);
    404407                } catch (InterruptedException e) {
     408                    // something has interrupted the waiting
    405409                    LOG.info(e.toString());
    406410                }
     411                // wait even longer
    407412                wait = wait * 2;
     413                // re-initialise the server
     414                serverError = null;
     415                initSolrServer();
    408416            }
    409417        }
    410418       
    411419        if (done) {
    412             // the documents are in the queue now, create a new empty list
     420            /* The current list of documents has been added to the queue; update
     421             * the number of documents that has been send to the server.
     422             */           
     423            nrOFDocumentsSend += docs.size();
     424            LOG.info("Send " + docs.size()
     425                    + " documents to solr server queue. Number that has been "
     426                    + "send so far: "
     427                    + nrOFDocumentsSend);
     428            /* The documents from the current list are in the queue now, create
     429             * a new empty list.
     430             */
    413431            docs = new ArrayList<SolrInputDocument>();
    414432        } else {
    415433            // the documents haven't reached the queue
    416434            if (wait > VloConfig.getSolrTimeOut()) {
    417                 LOG.error("Timeout sending list of documents to solr server queue");
     435                LOG.error("Timeout sending the current document list to solr server queue");
    418436            }
    419437            throw new SolrServerException(serverError);
  • vlo/trunk/vlo_importer/src/test/java/eu/clarin/cmdi/vlo/importer/MetadataImporterTest.java

    r3025 r3203  
    312312                LOG.info("Found " + nrOfIgnoredFiles
    313313                        + " file(s) that where ignored (files without resources or any link to a search service or landing page are ignored).");
    314                 LOG.info("Update of " + nrOFDocumentsUpdated + " took " + took +
     314                LOG.info("Update of " + nrOFDocumentsSend + " took " + took +
    315315                        " secs. Total nr of files analyzed " + nrOfFilesAnalyzed);
    316316            }
Note: See TracChangeset for help on using the changeset viewer.