org.compass.gps.device.support.parallel
Class ConcurrentParallelIndexExecutor

java.lang.Object
  extended by org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor
All Implemented Interfaces:
ParallelIndexExecutor

public class ConcurrentParallelIndexExecutor
extends Object
implements ParallelIndexExecutor

Executes the indexing process using sevearl threads based on the partitioned list of index entities.

By default (with maxThreads set to -1) creates N threads during the indexing process where N is the number of partitioned index entities groups (one therad per group). If maxThreads is set to a positive integer number, the index executor will use it as the number of threads to create, regardless of the number of partitioned entities groups.

Author:
kimchy

Constructor Summary
ConcurrentParallelIndexExecutor()
          Constructs a new concurrent index executor with maxThreads defaults to -1.
ConcurrentParallelIndexExecutor(int maxThreads)
          Constructs a new concurrent index executor with the given max threads.
 
Method Summary
 void performIndex(IndexEntity[][] entities, IndexEntitiesIndexer indexEntitiesIndexer, CompassGpsInterfaceDevice compassGps)
          Performs the indexing process using the provided index entities indexer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentParallelIndexExecutor

public ConcurrentParallelIndexExecutor()
Constructs a new concurrent index executor with maxThreads defaults to -1.


ConcurrentParallelIndexExecutor

public ConcurrentParallelIndexExecutor(int maxThreads)
Constructs a new concurrent index executor with the given max threads.

Parameters:
maxThreads - The number of threads to use or -1 for dynamic threads
Method Detail

performIndex

public void performIndex(IndexEntity[][] entities,
                         IndexEntitiesIndexer indexEntitiesIndexer,
                         CompassGpsInterfaceDevice compassGps)
Performs the indexing process using the provided index entities indexer. Creates a pool of N threads (if maxThreads is set to -1, N is the numer of entities groups, otherwise N is the number of maxThreads).

Specified by:
performIndex in interface ParallelIndexExecutor
Parameters:
entities - The partitioned index entities groups and index entities to index
indexEntitiesIndexer - The entities indexer to use
compassGps - Compass gps interface for meta information


Copyright (c) 2004-2008 The Compass Project.