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

com.bigdata.rdf.load.LoadStatementBufferFactory Maven / Gradle / Ivy

package com.bigdata.rdf.load;

import org.openrdf.model.Statement;

import com.bigdata.rdf.rio.StatementBuffer;
import com.bigdata.rdf.spo.ISPO;
import com.bigdata.rdf.store.AbstractTripleStore;
import com.bigdata.relation.accesspath.BlockingBuffer;

/**
 * 
 * @author Bryan Thompson
 * @version $Id$
 */
public class LoadStatementBufferFactory implements
        IStatementBufferFactory {

    private final AbstractTripleStore db;

    private final int bufferCapacity;

    /**
     * 
     * @param db
     * @param bufferCapacity
     */
    public LoadStatementBufferFactory(final AbstractTripleStore db,
            final int bufferCapacity) {

        this.db = db;

        this.bufferCapacity = bufferCapacity;
    
    }
    
    /**
     * Return the {@link StatementBuffer} to be used for a task.
     */
    public StatementBuffer newStatementBuffer() {

        return new StatementBuffer(null/* statementStore */, db,
                bufferCapacity, 10/*queueCapacity*/);

    }
    
//    /**
//     * Return the {@link ThreadLocal} {@link StatementBuffer} to be used for a
//     * task.
//     */
//    public StatementBuffer newStatementBuffer() {
//
//        /*
//         * Note: this is a thread-local so the same buffer object is always
//         * reused by the same thread.
//         */
//
//        return threadLocal.get();
//        
//    }
//
//    private ThreadLocal> threadLocal = new ThreadLocal>() {
//
//        protected synchronized StatementBuffer initialValue() {
//
//            return new StatementBuffer(null/* statementStore */, db,
//                    bufferCapacity, writeBuffer);
//            
//        }
//
//    };
    
}