org.hibernate.search.backend.impl.PerTransactionWorker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-search-engine Show documentation
Show all versions of hibernate-search-engine Show documentation
Core of the Object/Lucene mapper, query engine and index management
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.search.backend.impl;
import java.util.Properties;
import java.util.concurrent.ConcurrentMap;
import org.hibernate.search.cfg.Environment;
import org.hibernate.search.exception.AssertionFailure;
import org.hibernate.search.backend.spi.Work;
import org.hibernate.search.backend.spi.WorkType;
import org.hibernate.search.backend.spi.Worker;
import org.hibernate.search.engine.integration.impl.ExtendedSearchIntegrator;
import org.hibernate.search.engine.spi.EntityIndexBinding;
import org.hibernate.search.indexes.interceptor.EntityIndexingInterceptor;
import org.hibernate.search.indexes.interceptor.IndexingOverride;
import org.hibernate.search.util.configuration.impl.ConfigurationParseHelper;
import org.hibernate.search.util.impl.Maps;
import org.hibernate.search.util.logging.impl.Log;
import org.hibernate.search.exception.SearchException;
import org.hibernate.search.backend.TransactionContext;
import org.hibernate.search.spi.IndexedTypeIdentifier;
import org.hibernate.search.spi.InstanceInitializer;
import org.hibernate.search.spi.WorkerBuildContext;
import org.hibernate.search.util.logging.impl.LoggerFactory;
import java.lang.invoke.MethodHandles;
/**
* Queue works per transaction.
* If out of transaction, the work is executed right away
*
* When hibernate.search.worker.type
is set to async
* the work is done in a separate thread (threads are pooled)
*
* @author Emmanuel Bernard
*/
public class PerTransactionWorker implements Worker {
//note: there is only one Worker instance, reused concurrently for all sessions.
private static final Log log = LoggerFactory.make( MethodHandles.lookup() );
//this is being used from different threads, but doesn't need a
//synchronized map since for a given transaction, we have not concurrent access
protected final ConcurrentMap
© 2015 - 2025 Weber Informatics LLC | Privacy Policy