All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.search.backend.spi.Worker Maven / Gradle / Ivy

There is a newer version: 5.11.12.Final
Show newest version
/*
 * 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.spi;

import java.util.Properties;

import org.hibernate.search.backend.TransactionContext;
import org.hibernate.search.backend.impl.QueueingProcessor;
import org.hibernate.search.spi.WorkerBuildContext;

/**
 * Perform work for a given context (eg a transaction). This implementation has to be threaded-safe.
 *
 * @author Emmanuel Bernard
 */
public interface Worker {
	/**
	 * Declare a work to be done within a given transaction context
	 *
	 * @param work the work to be executed
	 * @param transactionContext transactional context information
	 */
	void performWork(Work work, TransactionContext transactionContext);

	void initialize(Properties props, WorkerBuildContext context, QueueingProcessor queueingProcessor);

	/**
	 * clean resources
	 * This method can return exceptions
	 */
	void close();

	/**
	 * Flush any work queue.
	 *
	 * @param transactionContext the current transaction (context).
	 */
	void flushWorks(TransactionContext transactionContext);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy