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

org.hibernate.search.backend.impl.lucene.Changeset 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.impl.lucene;

import org.hibernate.search.backend.IndexingMonitor;
import org.hibernate.search.backend.LuceneWork;

import java.util.Iterator;
import java.util.List;
import java.util.concurrent.locks.LockSupport;

/**
 * A Changeset is a work to be applied to the index and its associated producer
 *
 * @author gustavonalle
 */
public final class Changeset implements Iterable {

	private final List workList;
	private final Thread producer;
	private final IndexingMonitor monitor;
	private volatile boolean processed = false;

	public Changeset(List workList, Thread producer, IndexingMonitor monitor) {
		this.workList = workList;
		this.producer = producer;
		this.monitor = monitor;
	}

	@Override
	public Iterator iterator() {
		return workList.iterator();
	}

	IndexingMonitor getMonitor() {
		return monitor;
	}

	boolean isProcessed() {
		return processed;
	}

	public void markProcessed() {
		processed = true;
		LockSupport.unpark( producer );
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy