• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java VoltProcedure类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.voltdb.VoltProcedure的典型用法代码示例。如果您正苦于以下问题:Java VoltProcedure类的具体用法?Java VoltProcedure怎么用?Java VoltProcedure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

VoltProcedure类属于org.voltdb包,在下文中一共展示了VoltProcedure类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getVoltMapReduceProcedure

点赞 3

import org.voltdb.VoltProcedure; //导入依赖的package包/类
/**
 * Returns the VoltMapReduceProcedure handle for the given Procedure that
 * is initialized for the specific partition.
 * @param catalog_proc
 * @param partition
 * @return
 */
@SuppressWarnings("unchecked")
protected VoltMapReduceProcedure<?> getVoltMapReduceProcedure(Procedure catalog_proc, int partition) {
    assert(catalog_proc.getMapreduce());
    assert(catalog_proc.getHasjava());
    assert(hstore_site.isLocalPartition(partition));
    
    PartitionExecutor executor = hstore_site.getPartitionExecutor(partition);
    VoltMapReduceProcedure<?> volt_proc = null;

    // TODO: We are creating a new instance every single time per partition.
    //       We can probably cache these...
    // Only try to load the Java class file for the SP if it has one
    Class<? extends VoltProcedure> p_class = null;
    final String className = catalog_proc.getClassname();
    try {
        p_class = (Class<? extends VoltMapReduceProcedure<?>>)Class.forName(className);
        volt_proc = (VoltMapReduceProcedure<?>)p_class.newInstance();
    } catch (Exception e) {
        throw new ServerFaultException("Failed to created VoltProcedure instance for " + catalog_proc.getName() , e);
    }
    volt_proc.init(executor, catalog_proc, executor.getBackendTarget());
    return (volt_proc);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:31,
代码来源:MapReduceHelperThread.java

示例2: VoltProcedureFactory

点赞 3

import org.voltdb.VoltProcedure; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public VoltProcedureFactory(PartitionExecutor executor, Procedure catalog_proc) {
    super(executor.getHStoreConf().site.pool_profiling);
    this.executor = executor;
    this.catalog_proc = catalog_proc;
    this.has_java = this.catalog_proc.getHasjava();
    
    // Only try to load the Java class file for the SP if it has one
    Class<? extends VoltProcedure> p_class = null;
    if (catalog_proc.getHasjava()) {
        final String className = catalog_proc.getClassname();
        try {
            p_class = (Class<? extends VoltProcedure>)Class.forName(className);
        } catch (final ClassNotFoundException e) {
            LOG.fatal("Failed to load procedure class '" + className + "'", e);
            throw new RuntimeException(e);
        }
    }
    this.proc_class = p_class;

}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:22,
代码来源:VoltProcedureFactory.java

示例3: antiCacheEvictBlock

点赞 3

import org.voltdb.VoltProcedure; //导入依赖的package包/类
@Override
public VoltTable antiCacheEvictBlock(Table catalog_tbl, long block_size, int num_blocks) {
    if (m_anticache == false) {
        String msg = "Trying to invoke anti-caching operation but feature is not enabled";
        throw new VoltProcedure.VoltAbortException(msg);
    }
    deserializer.clear();
    
    final int numResults = nativeAntiCacheEvictBlock(this.pointer, catalog_tbl.getRelativeIndex(), block_size, num_blocks);
    if (numResults == -1) {
        throwExceptionForError(ERRORCODE_ERROR);
    }
    try {
        deserializer.readInt();//Ignore the length of the result tables
        final VoltTable results[] = new VoltTable[numResults];
        for (int ii = 0; ii < numResults; ii++) {
            final VoltTable resultTable = PrivateVoltTableFactory.createUninitializedVoltTable();
            results[ii] = (VoltTable)deserializer.readObject(resultTable, this);
        }
        return results[0];
    } catch (final IOException ex) {
        LOG.error("Failed to deserialze result table for antiCacheEvictBlock" + ex);
        throw new EEException(ERRORCODE_WRONG_SERIALIZED_BYTES);
    }
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:26,
代码来源:ExecutionEngineJNI.java

示例4: setUp

点赞 3

import org.voltdb.VoltProcedure; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
    super.setUp(this.builder);
    this.addPartitions(NUM_PARTITIONS);
    this.catalog_proc = this.getProcedure(TARGET_PROCEDURE);
    
    this.batch = new SQLStmt[this.catalog_proc.getStatements().size()];
    this.args = new ParameterSet[this.batch.length];
    this.stmtCounters = new int[this.batch.length];
    int i = 0;
    for (Statement catalog_stmt : this.catalog_proc.getStatements()) {
        this.batch[i] = new SQLStmt(catalog_stmt);
        this.args[i] = ParameterSet.EMPTY;
        this.stmtCounters[i] = i;
        i++;
    } // FOR

    VoltProcedure volt_proc = ClassUtil.newInstance(TARGET_PROCEDURE, new Object[0], new Class<?>[0]);
    assert(volt_proc != null);
    this.executor = new MockPartitionExecutor(BASE_PARTITION, catalogContext, p_estimator);
    volt_proc.init(this.executor, catalog_proc, BackendTarget.NONE);
    
    this.planner = new BatchPlanner(this.batch, this.catalog_proc, p_estimator);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:25,
代码来源:TestBatchPlannerComplex.java

示例5: testReplicatedTableTouchedPartitions

点赞 3

import org.voltdb.VoltProcedure; //导入依赖的package包/类
/**
 * testReplicatedTableTouchedPartitions
 */
public void testReplicatedTableTouchedPartitions() throws Exception {
    Procedure catalog_proc = this.getProcedure(neworder.class);
    Statement catalog_stmt = this.getStatement(catalog_proc, "getItemInfo");
    
    SQLStmt batch[] = { new SQLStmt(catalog_stmt) };
    ParameterSet params[] = new ParameterSet[]{
            VoltProcedure.getCleanParams(batch[0], new Object[]{ new Long(1) })
    };
    PartitionSet partitions = new PartitionSet(0);
    
    // Check to make sure that if we do a SELECT on a replicated table, that
    // it doesn't get added to our touched partitions histogram
    BatchPlanner batchPlan = new BatchPlanner(batch, catalog_proc, p_estimator);
    BatchPlanner.BatchPlan plan = batchPlan.plan(TXN_ID, BASE_PARTITION, partitions, this.touched_partitions, params);
    assertNotNull(plan);
    assertFalse(plan.hasMisprediction());
    
    assertEquals(0, this.touched_partitions.getValueCount());
    assertEquals(0, this.touched_partitions.getSampleCount());
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:24,
代码来源:TestBatchPlannerUtil.java

示例6: init

点赞 3

import org.voltdb.VoltProcedure; //导入依赖的package包/类
private void init(Class<? extends VoltProcedure> volt_proc, String stmt_name, Object raw_args[]) {
    this.catalog_proc = this.getProcedure(volt_proc);
    assertNotNull(this.catalog_proc);
    this.catalog_stmt = this.catalog_proc.getStatements().get(stmt_name);
    assertNotNull(this.catalog_stmt);
    
    CatalogMap<PlanFragment> fragments = null;
    if (this.catalog_stmt.getQuerytype() == QueryType.INSERT.getValue()) {
        fragments = this.catalog_stmt.getFragments();
    } else {
        assert(this.catalog_stmt.getHas_multisited());
        fragments = this.catalog_stmt.getMs_fragments();
    }

    // Create a SQLStmt batch
    this.batch = new SQLStmt[] { new SQLStmt(this.catalog_stmt, fragments) };
    this.args = new ParameterSet[] { VoltProcedure.getCleanParams(this.batch[0], raw_args) };
    this.stmtCounters = new int[]{ 0 };
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:20,
代码来源:TestBatchPlanner.java

示例7: initializeVoltProcedures

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
protected void initializeVoltProcedures() {
    // load up all the stored procedures
    for (final Procedure catalog_proc : catalogContext.procedures) {
        VoltProcedure volt_proc = this.initializeVoltProcedure(catalog_proc);
        Queue<VoltProcedure> queue = new LinkedList<VoltProcedure>();
        queue.add(volt_proc);
        this.procedures[catalog_proc.getId()] = queue;
    } // FOR
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:10,
代码来源:PartitionExecutor.java

示例8: getVoltProcedure

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
/**
 * Returns a new VoltProcedure instance for a given stored procedure name
 * <B>Note:</B> You will get a new VoltProcedure for each invocation
 * @param proc_name
 * @return
 */
protected VoltProcedure getVoltProcedure(int proc_id) {
    VoltProcedure voltProc = this.procedures[proc_id].poll();
    if (voltProc == null) {
        Procedure catalog_proc = catalogContext.getProcedureById(proc_id);
        voltProc = this.initializeVoltProcedure(catalog_proc);
    }
    return (voltProc);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:15,
代码来源:PartitionExecutor.java

示例9: addPlanner

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
/**
 * Initialize a new cached BatchPlanner that is specific to the prefetch batch. 
 * @param catalog_proc
 * @param prefetchable
 * @param prefetchStmts
 * @return
 */
protected BatchPlanner addPlanner(Procedure catalog_proc,
                                  List<CountedStatement> prefetchable,
                                  SQLStmt[] prefetchStmts) {
    BatchPlanner planner = new BatchPlanner(prefetchStmts, prefetchStmts.length, catalog_proc, this.p_estimator);
    planner.setPrefetchFlag(true);
    
    int batchId = VoltProcedure.getBatchHashCode(prefetchStmts, prefetchStmts.length);
    this.planners.get().put(batchId, planner);
    
    if (debug.val)
        LOG.debug(String.format("%s Prefetch Statements: %s",
                  catalog_proc.getName(), Arrays.toString(prefetchStmts)));
    return planner;
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:22,
代码来源:PrefetchQueryPlanner.java

示例10: AbstractProjectBuilder

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
/**
 * Full Constructor
 * @param project_name
 * @param base_class
 * @param procedures
 * @param partitioning
 * @param supplementals
 * @param fkeys
 */
public AbstractProjectBuilder(String project_name, Class<? extends AbstractProjectBuilder> base_class, Class<? extends VoltProcedure> procedures[], String partitioning[][], Class<?> supplementals[], boolean fkeys) {
    super(project_name);
    this.base_class = base_class;
    this.procedures = procedures;
    this.partitioning = partitioning;
    this.supplementals = supplementals;
    
    this.ddlURL = this.base_class.getResource(this.getDDLName(true));
    this.parameterMappings = this.getParameterMappings();
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:20,
代码来源:AbstractProjectBuilder.java

示例11: getTransactionFrequencyString

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
public String getTransactionFrequencyString() {
    StringBuilder sb = new StringBuilder();
    String add = "";
    for (Entry<Class<? extends VoltProcedure>, Integer> e : txn_frequencies.entrySet()) {
        sb.append(add).append(e.getKey().getSimpleName()).append(":").append(e.getValue());
        add = ",";
    }
    return (sb.toString());
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:10,
代码来源:AbstractProjectBuilder.java

示例12: include

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ProcedureNameFilter include(Class<? extends VoltProcedure>...procClasses) {
    for (Class<? extends VoltProcedure> procClass : procClasses) {
        this.include(procClass.getSimpleName(), INCLUDE_UNLIMITED);
    }
    return (this);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:8,
代码来源:ProcedureNameFilter.java

示例13: antiCacheReadBlocks

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
@Override
public void antiCacheReadBlocks(Table catalog_tbl, short[] block_ids, int[] tuple_offsets) {
    if (m_anticache == false) {
        String msg = "Trying to invoke anti-caching operation but feature is not enabled";
        throw new VoltProcedure.VoltAbortException(msg);
    }
    final int errorCode = nativeAntiCacheReadBlocks(this.pointer, catalog_tbl.getRelativeIndex(), block_ids, tuple_offsets);
    checkErrorCode(errorCode);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:10,
代码来源:ExecutionEngineJNI.java

示例14: testMultipleGetVoltProcedure

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
/**
 * testMultipleGetVoltProcedure
 */
@Test
public void testMultipleGetVoltProcedure() {
    // Invoke getVoltProcedure() multiple times and make sure that we never get back the same handle
    int count = 10;
    Set<VoltProcedure> procs = new HashSet<VoltProcedure>();
    for (int i = 0; i < count; i++) {
        VoltProcedure volt_proc = executor.getVoltProcedure(catalog_proc.getId());
        assertNotNull(volt_proc);
        assertFalse(procs.contains(volt_proc));
        procs.add(volt_proc);
    } // FOR
    assertEquals(count, procs.size());
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:17,
代码来源:TestPartitionExecutor.java

示例15: init

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
private void init(Class<? extends VoltProcedure> volt_proc, String stmt_name, Object raw_args[]) {
    this.catalog_proc = this.getProcedure(volt_proc);
    assertNotNull(this.catalog_proc);
    this.catalog_stmt = this.catalog_proc.getStatements().get(stmt_name);
    assertNotNull(this.catalog_stmt);
    assertTrue(this.catalog_stmt.fullName(), this.catalog_stmt.getHas_singlesited());
    CatalogMap<PlanFragment> fragments = this.catalog_stmt.getFragments();

    // Create a SQLStmt batch
    this.batch = new SQLStmt[] { new SQLStmt(this.catalog_stmt, fragments) };
    this.args = new ParameterSet[] { VoltProcedure.getCleanParams(this.batch[0], raw_args) };
    this.stmtCounters = new int[]{ 0 };
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:14,
代码来源:TestBatchPlannerMapReduce.java

示例16: setUp

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    this.reset(ProjectType.TPCC);
    super.setUp(this.builder);
    this.addPartitions(NUM_PARTITIONS);
    
    if (isFirstSetup()) {
        
        File file = this.getWorkloadFile(ProjectType.TPCC);
        workload = new Workload(catalogContext.catalog);
        ProcParameterValueFilter filter = new ProcParameterValueFilter().include(1, TARGET_DISTRICT_ID);
        for (int w_id : TARGET_WAREHOUSES) {
            filter.include(0, w_id);
        } // FOR
        ProcedureNameFilter procFilter = new ProcedureNameFilter(false);
        for (Class<? extends VoltProcedure> procClass : TARGET_PROCEDURES) {
            procFilter.include(procClass.getSimpleName(), WORKLOAD_XACT_LIMIT);
        } // FOR
        workload.load(file, catalogContext.database, filter.attach(procFilter));

        // Generate MarkovGraphs per base partition
        markovs = MarkovGraphsContainerUtil.createBasePartitionMarkovGraphsContainer(catalogContext,
                                                                                     workload, p_estimator);
    }
    assertNotNull(markovs);
    
    this.hstore_site = new MockHStoreSite(0, catalogContext, HStoreConf.singleton());
    this.checker = new MarkovConflictChecker(catalogContext, thresholds);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:30,
代码来源:TestMarkovConflictChecker.java

示例17: getCurrentVoltProcedure

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T extends VoltProcedure> T getCurrentVoltProcedure(PartitionExecutor executor, Class<T> expectedType) {
    int tries = 3;
    VoltProcedure voltProc = null;
    while (tries-- > 0) {
        voltProc = executor.getDebugContext().getCurrentVoltProcedure();
        if (voltProc != null) break;
        ThreadUtil.sleep(NOTIFY_TIMEOUT);    
    } // WHILE
    assertNotNull(String.format("Failed to get %s from %s", expectedType, executor), voltProc);
    assertEquals(expectedType, voltProc.getClass());
    return ((T)voltProc);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:14,
代码来源:HStoreSiteTestUtil.java

示例18: getProcedure

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected final Procedure getProcedure(Database catalog_db, Class<? extends VoltProcedure> proc_class) {
    String procName;
    if (ClassUtil.getSuperClasses(proc_class).contains(VoltSystemProcedure.class)) {
        procName = VoltSystemProcedure.procCallName((Class<? extends VoltSystemProcedure>)proc_class);
    } else {
        procName = proc_class.getSimpleName();
    }
    return getProcedure(catalog_db, procName);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:11,
代码来源:BaseTestCase.java

示例19: compile

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
protected String compile(String name, Class<? extends VoltProcedure>... procList) {
    TPCCProjectBuilder builder = new TPCCProjectBuilder();
    builder.addDefaultSchema();
    builder.addDefaultPartitioning();
    builder.addProcedures(procList);
    String retval = "tpcc-catalogcheck-" + name + ".jar";
    builder.compile(retval);
    return retval;
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:10,
代码来源:TestCatalogDiffs.java

示例20: finishVoltProcedure

点赞 2

import org.voltdb.VoltProcedure; //导入依赖的package包/类
/**
 * Return the given VoltProcedure back into the queue to be re-used again
 * @param voltProc
 */
protected void finishVoltProcedure(VoltProcedure voltProc) {
    voltProc.finish();
    this.procedures[voltProc.getProcedureId()].offer(voltProc);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:9,
代码来源:PartitionExecutor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)