Class TerracottaTransactionProcessorFactory

  extended by org.compass.needle.terracotta.transaction.processor.TerracottaTransactionProcessorFactory
All Implemented Interfaces:
CompassConfigurable, SearchEngineFactoryAware, TransactionProcessorFactory

public class TerracottaTransactionProcessorFactory
extends Object
implements TransactionProcessorFactory, CompassConfigurable, SearchEngineFactoryAware

The terracotta transaction processor factory allows to add TransactionJobs to a shared work queue (partitioned by sub index) to be processed later by worker processors.

By default, the transaction processor factory acts as a worker processor as well. In order to disable it (and make it only a producer node) set the TerracottaTransactionProcessorEnvironment.PROCESS to false.

By default, each worker processor node will try and processes jobs from all sub indexes (you can start as many as you like). In order to pin down the worker processor to work only on specific sub indexes, set then using TerracottaTransactionProcessorEnvironment.SUB_INDEXES setting.

The processor itself, once it identifies that there is a transactional job to be processed, will try and get more transactional jobs in a non blocking manner for better utilization of an already opened IndexWriter. By default it will try and get 5 more, and it can be controlled using TerracottaTransactionProcessorEnvironment.NON_BLOCKING_BATCH_JOBS_SIZE.

Transactions visibility (once a transaction commits, how long till the other nodes, including the one that committed will see the result) can be controlld using LuceneEnvironment.SearchEngineIndex.CACHE_INTERVAL_INVALIDATION. Note, by default, refreshing to a new index happens in the background and does not affect the search nodes.

When working with several machines, the index should probably be shared between all nodes. The terracotta based directory store can be used to share the index as well.


Constructor Summary
Method Summary
 Map<String,TransactionJobs> add(TransactionJobs jobs)
 void close()
          Closes the transaction factory.
 void configure(CompassSettings settings)
          Configure using the given settings.
 TransactionProcessor create(LuceneSearchEngine searchEngine)
          Creates a new transaction processor to handle a transaction.
 boolean isThreadSafe()
          The terracotta transaction processor is not thread safe.
 void remove(Map<String,TransactionJobs> subIndexesJobs)
 void setSearchEngineFactory(SearchEngineFactory searchEngineFactory)
          Injects the search engine factory.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public TerracottaTransactionProcessorFactory()
Method Detail


public void setSearchEngineFactory(SearchEngineFactory searchEngineFactory)
Description copied from interface: SearchEngineFactoryAware
Injects the search engine factory.

Specified by:
setSearchEngineFactory in interface SearchEngineFactoryAware


public void configure(CompassSettings settings)
               throws CompassException
Description copied from interface: CompassConfigurable
Configure using the given settings.

Specified by:
configure in interface CompassConfigurable
settings - The settings for the configured object


public TransactionProcessor create(LuceneSearchEngine searchEngine)
Description copied from interface: TransactionProcessorFactory
Creates a new transaction processor to handle a transaction.

Specified by:
create in interface TransactionProcessorFactory


public void close()
Description copied from interface: TransactionProcessorFactory
Closes the transaction factory.

Specified by:
close in interface TransactionProcessorFactory


public boolean isThreadSafe()
The terracotta transaction processor is not thread safe.

Specified by:
isThreadSafe in interface TransactionProcessorFactory


public Map<String,TransactionJobs> add(TransactionJobs jobs)


public void remove(Map<String,TransactionJobs> subIndexesJobs)

Copyright (c) 2004-2009 The Compass Project.