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

net.sf.xsd2pgschema.implement.CloseLuceneIdxThrd Maven / Gradle / Ivy

There is a newer version: 5.3.8
Show newest version
/*
    xsd2pgschema - Database replication tool based on XML Schema
    Copyright 2020 Masashi Yokochi

    https://sourceforge.net/projects/xsd2pgschema/

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 */

package net.sf.xsd2pgschema.implement;

import java.io.IOException;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * Implementation of Lucene index closer.
 *
 * @author yokochi
 */
public class CloseLuceneIdxThrd implements Runnable {

	/** The instance of Xml2LuceneIdxThrd. */
	private Xml2LuceneIdxThrd thrd;

	/** The poll for finished thread. initial size of the list should be equal to size of threads - 1 */
	private LinkedBlockingQueue thrd_poll;

	/**
	 * Instance of CloseLuceneIdxThrd.
	 *
	 * @param thrd instance of Xml2LuceneIdxThrd
	 * @param thrd_poll thread poll, initial size of the list should be equal to size of threads - 1
	 */
	public CloseLuceneIdxThrd(final Xml2LuceneIdxThrd thrd, LinkedBlockingQueue thrd_poll) {

		this.thrd = thrd;
		this.thrd_poll = thrd_poll;

	}

	/* (non-Javadoc)
	 * @see java.lang.Runnable#run()
	 */
	@Override
	public void run() {

		try {

			thrd.close(thrd_poll);

		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}

	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy