Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
Copyright (C) SYSTAP, LLC DBA Blazegraph 2006-2016. All rights reserved.
Contact:
SYSTAP, LLC DBA Blazegraph
2501 Calvert ST NW #106
Washington, DC 20008
[email protected]
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Created on Nov 14, 2007
*/
package com.bigdata.rdf.inf;
import java.util.NoSuchElementException;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.log4j.Logger;
import com.bigdata.btree.IIndex;
import com.bigdata.btree.IRangeQuery;
import com.bigdata.btree.ITupleIterator;
import com.bigdata.journal.IIndexManager;
import com.bigdata.relation.accesspath.IElementFilter;
import com.bigdata.util.Bytes;
/**
* Iterator visits {@link Justification}s reading from the justification index.
* The iterator optionally supports asynchronous read ahead.
*
* @author Bryan Thompson
* @version $Id$
*
* @deprecated replace with appropriate access path reading on the
* justifications index for SPORelation (or treat as a secondary
* relation).
*/
public class JustificationIterator implements IJustificationIterator {
private static final transient Logger log = Logger
.getLogger(JustificationIterator.class);
/**
* The maximum #of statements that will be buffered by the iterator.
*/
private static final transient int MAXIMUM_CAPACITY = 10 * Bytes.kilobyte32; // was 100k
private boolean open = true;
/**
* The actual capacity of the buffer (never zero).
*/
private final int capacity;
/**
* The #of statements that have been read from the source
* and placed into the buffer. All such statements will also have passed the
* optional {@link IElementFilter}.
*/
private int numBuffered;
/**
* The #of statements that have been read by the caller using
* {@link #next()}.
*/
private int numReadByCaller;
/**
* The #of chunks that have been read by the caller.
*/
private int nchunks = 0;
/**
* A buffer holding {@link Justification}s that have not been visited.
* {@link Justification}s that have been visited are taken from the buffer,
* making room for new statements which can be filled in asynchronously by
* the {@link Reader}.
*/
private ArrayBlockingQueue buffer;
/**
* The source iterator reading on the selected justification index.
*/
private ITupleIterator> src;
// /**
// * The executor service for the {@link Reader} (iff the {@link Reader} runs
// * asynchronously).
// */
// private final ExecutorService readService;
/**
* The future for the {@link Reader} and null if a synchronous
* read was performed (fully buffered read in the caller's thread).
*/
private final FutureTask