You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2010/09/10 14:23:43 UTC
[Solr Wiki] Trivial Update of "DataImportHandler" by MarkoBonaci
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The "DataImportHandler" page has been changed by MarkoBonaci.
http://wiki.apache.org/solr/DataImportHandler?action=diff&rev1=252&rev2=253
--------------------------------------------------
<<Anchor(scheduling)>>
- = Scheduling DIH =
+ = Scheduling =
+ * Version 1.0
* Author Marko Bonaci, Croatia
- * Version 1.0
+ * Enables scheduling DIH delta and/or full imports
* Proofs the concept, needs almost complete overhaul
- * Tested on Apache Tomcat v6
+ * Successfully tested on Apache Tomcat v6 (should work on any container)
+ * Wasn't incorporated in SVN (needs more polishing in order to commit)
Global /!\ :TODO: /!\
* add comments to methods
* try to use Solr's internal classes wherever possible
+ * parametrize the schedule interval in minutes (currently set to 10 minutes in ApplicationListener's contextInitialized method)
+ == Prereqs ==
+ * working DIH configuration in place
+ * dataimport.properties file in folder ''solr.home/conf/'' with mandatory params inside (see bellow for the example of dataimport.properties)
== SolrDataImportProperties ==
+ * uses [[http://download.oracle.com/javase/6/docs/api/java/util/Properties.html|java.util.Properties]] to get settings from dataimport.properties
+
- * the class uses resource loading to get DIHScheduler settings
- * requires dataimport.properties file in folder solr.home/conf/
- * see constants for param names which should be added to dataimport.properties
/!\ :TODO: /!\
* uses system property for locating solr.home (use Solr's resource loader instead)
@@ -1137, +1142 @@
public void contextInitialized(ServletContextEvent servletContextEvent) {
ServletContext servletContext = servletContextEvent.getServletContext();
try{
- // create the timer and timer task objects
+ // create the timer and HTTPPostScheduler (TimerTask) objects
Timer timer = new Timer();
HTTPPostScheduler task = new HTTPPostScheduler(servletContext.getServletContextName());
@@ -1145, +1150 @@
Calendar calendar = Calendar.getInstance();
Date startTime = calendar.getTime();
- // schedule the task to run hourly
+ // schedule the task to run every ten minutes
timer.scheduleAtFixedRate(task, startTime, 1000 * 60 * 10);
- // save our timer for later use
+ // save our timer in context attribute map for later use
servletContext.setAttribute("timer", timer);
} catch (Exception e) {