FileDocCategorySizeDatePackage
TimedIndexTask.javaAPI DocApache Lucene 2.1.02299Wed Feb 14 10:46:06 GMT 2007org.apache.lucene.gdata.search.index

TimedIndexTask

public class TimedIndexTask extends IndexTask
This {@link IndexTask} will idle the given time if no task is on the queue. If the idle time exceeds the task will force a commit on the index. The timer will be reset if a task is on the queue.
author
Simon Willnauer

Fields Summary
protected static final TimeUnit
TIME_UNIT
protected static final long
DEFAULT_IDLE_TIME
private final long
idleTime
Constructors Summary
TimedIndexTask(GDataIndexer indexer, BlockingQueue taskQueue, long idleTime)


      
              
               
        super(indexer, taskQueue);
        this.idleTime = idleTime < DEFAULT_IDLE_TIME ? DEFAULT_IDLE_TIME
                : idleTime;

    
Methods Summary
protected longgetIdleTime()

        return this.idleTime;
    
protected java.util.concurrent.FuturegetTask()

see
org.apache.lucene.gdata.search.index.IndexTask#getTask()

        /*
         * wait for a certain time and return null if no task is on the queue.
         * If return null --> commit will be called
         */
        Future<IndexDocument> retVal = this.taskQueue.poll(this.idleTime, TIME_UNIT);
        if(retVal== null)
            this.commit.set(true);
        return retVal;