当前位置: 首页>>代码示例>>Java>>正文


Java ExecutionEngine类代码示例

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


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

示例1: initiateSnapshots

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
public void initiateSnapshots(ExecutionEngine ee, Deque<SnapshotTableTask> tasks) {
    LOG.trace("initiateSnapshots at : partition "+ee.getPartitionExecutor().getPartitionId()+ " tasks size ::"+tasks.size());
    
    m_snapshotTableTasks = new ArrayDeque<SnapshotTableTask>(tasks);
    m_snapshotTargets = new ArrayList<SnapshotDataTarget>();
    for (final SnapshotTableTask task : tasks) {
        if (!task.m_isReplicated) {
            assert(task != null);
            assert(m_snapshotTargets != null);
            m_snapshotTargets.add(task.m_target);
        }
        // FIXME meng
       if (!ee.activateTableStream(task.m_tableId, TableStreamType.SNAPSHOT )) {
           LOG.error("Attempted to activate copy on write mode for table "
                   + task.m_name + " and failed");
           LOG.error(task);
           HStore.crashDB();
       }
       else{
           LOG.trace("Activated COW mode for table "+task.m_name+" at partition "+ee.getPartitionExecutor().getPartitionId());
       }
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:SnapshotSiteProcessor.java

示例2: generateCurrentSample

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
/**
 * Poll the operating system and generate a Datum
 * @return A newly created Datum instance.
 */
private static synchronized Datum generateCurrentSample() {
    // get this info once
    if (!initialized) initialize();

    long rss = -1;
    switch (mode) {
    case MACOSX_NATIVE:
        rss = ExecutionEngine.nativeGetRSS();
        break;
    case PROCFS:
        rss = getRSSFromProcFS();
        break;
    case PS:
        rss = PSScraper.getPSData(pid).rss;
        break;
    }

    // create a new Datum which adds java stats
    Datum d = new Datum(rss);
    return d;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:26,代码来源:SystemStatsCollector.java

示例3: testSameLongHash

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
public void testSameLongHash() {
    ExecutionEngine ee = new ExecutionEngineJNI(null, 1, 1, 0, 0, "");

    /**
     *  Run with 100k of random values and make sure C++ and Java hash to
     *  the same value.
     */
    for (int i = 0; i < 100000; i++) {
        int partitionCount = r.nextInt(1000) + 1;
        // this will produce negative values, which is desired here.
        long valueToHash = r.nextLong();

        int eehash = ee.hashinate(valueToHash, partitionCount);
        int javahash = TheHashinator.hashinate(valueToHash, partitionCount);
        assertEquals(eehash, javahash);
        assertTrue(eehash < partitionCount);
        assertTrue(eehash > -1);
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:TestTheHashinator.java

示例4: testSameStringHash

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
public void testSameStringHash() {
    ExecutionEngine ee = new ExecutionEngineJNI(null, 1, 1, 0, 0, "");

    for (int i = 0; i < 100000; i++) {
        int partitionCount = r.nextInt(1000) + 1;
        String valueToHash = Long.toString(r.nextLong());

        int eehash = ee.hashinate(valueToHash, partitionCount);
        int javahash = TheHashinator.hashinate(valueToHash, partitionCount);
        if (eehash != javahash) {
            partitionCount++;
        }
        assertEquals(eehash, javahash);
        assertTrue(eehash < partitionCount);
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:TestTheHashinator.java

示例5: doPhysicalRecovery

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
public void doPhysicalRecovery() {
    while (!m_ariesLog.isReadyForReplay()) {
        try {
            // don't sleep for too long as recovery numbers might get biased
            Thread.sleep(500);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }        

    LOG.info("ARIES : ariesLog is ready for replay at site :"+this.site_id);

    if (!m_ariesLog.isRecoveryCompleted()) {
        int m_siteId = this.getSiteId();
        CatalogMap<Partition> partitionMap = this.catalog_site.getPartitions();

        for (Partition pt : partitionMap ) {
            PartitionExecutor pe =  getPartitionExecutor(pt.getId());
            assert (pe != null);

            ExecutionEngine ee = pe.getExecutionEngine();
            assert (ee != null);

            int m_partitionId = pe.getPartitionId();

            LOG.info("ARIES : start recovery at partition  :"+m_partitionId+" on site :"+m_siteId);
            
            if (!m_ariesLog.isRecoveryCompletedForSite(m_partitionId)) {
                ee.doAriesRecoveryPhase(m_ariesLog.getPointerToReplayLog(), m_ariesLog.getReplayLogSize(), m_ariesLog.getTxnIdToBeginReplay());
                m_ariesLog.setRecoveryCompleted(m_partitionId);                
            }
        }
    }

    LOG.info("ARIES : recovery completed at site :"+this.site_id);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:38,代码来源:HStoreSite.java

示例6: loadOrAddRefPlanFragment

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
/**
 * Get the site-local fragment id for a given plan identified by 20-byte sha-1 hash
 * If the plan isn't known to this SPC, load it up. Otherwise addref it.
 */
public static long loadOrAddRefPlanFragment(byte[] planHash, byte[] plan, String stmtText) {
    Sha1Wrapper key = new Sha1Wrapper(planHash);
    synchronized (FragInfo.class) {
        FragInfo frag = m_plansByHash.get(key);
        if (frag == null) {
            frag = new FragInfo(key, plan, m_nextFragId++, stmtText);
            m_plansByHash.put(frag.hash, frag);
            m_plansById.put(frag.fragId, frag);
            if (m_plansById.size() > ExecutionEngine.EE_PLAN_CACHE_SIZE) {
                evictLRUfragment();
            }
        }

        // Bit of a hack to work around an issue where a statement-less adhoc
        // fragment could be identical to a statement-needing regular procedure.
        // This doesn't really address the broader issue that fragment hashes
        // are not 1-1 with SQL statements.
        if (frag.stmtText == null) {
            frag.stmtText = stmtText;
        }

        // The fragment MAY be in the LRU map.
        // An incremented refCount is a lazy way to keep it safe from eviction
        // without having to update the map.
        // This optimizes for popular fragments in a small or stable cache that may be reused
        // many times before the eviction process needs to take any notice.
        frag.refCount++;
        return frag.fragId;
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:35,代码来源:ActivePlanRepository.java

示例7: testExpectNonZeroHash

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
@Test
public void testExpectNonZeroHash() throws Exception {
    int partitionCount = 3;
    final byte configBytes[] = TheHashinator.getConfigureBytes(partitionCount);
    TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), configBytes);
    HashinatorConfig config = TheHashinator.getCurrentConfig();
    ExecutionEngine ee =
            new ExecutionEngineJNI(
                    1,
                    1,
                    0,
                    0,
                    "",
                    100,
                    config);

    long valueToHash = hashinatorType == HashinatorType.ELASTIC ? 39: 2;

    int eehash = ee.hashinate(valueToHash, config);
    int javahash = TheHashinator.getPartitionForParameter(VoltType.typeFromObject(valueToHash).getValue(),
            valueToHash);
    if (eehash != javahash) {
        System.out.printf("Mismatched hash of (%s) %d with %d partitions => EE: %d, Java: %d\n",
                VoltType.typeFromObject(valueToHash).toSQLString(),
                valueToHash, partitionCount, eehash, javahash);
    }
    assertEquals(eehash, javahash);
    assertNotSame(0, eehash);
    assertTrue(eehash < partitionCount);
    assertTrue(eehash >= 0);

    try { ee.release(); } catch (Exception e) {}
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:34,代码来源:TestTheHashinator.java

示例8: testSameLongHash

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
@Test
public void testSameLongHash() throws Exception {
    byte configBytes[] = TheHashinator.getConfigureBytes(1);
    ExecutionEngine ee = new ExecutionEngineJNI(1, 1, 0, 0, "", 100, new HashinatorConfig(hashinatorType, configBytes, 0, 0));

    /**
     *  Run with 10k of random values and make sure C++ and Java hash to
     *  the same value.
     */
    for (int i = 0; i < 1500; i++) {
        final int partitionCount = r.nextInt(1000) + 1;
        configBytes = TheHashinator.getConfigureBytes(partitionCount);
        TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), configBytes);
        // this will produce negative values, which is desired here.
        final long valueToHash = r.nextLong();
        final int javahash = TheHashinator.getPartitionForParameter(VoltType.typeFromObject(valueToHash).getValue(),
                                                                    valueToHash);
        final int eehash = ee.hashinate(valueToHash, TheHashinator.getCurrentConfig());
        if (eehash != javahash) {
            System.out.printf("Mismatched hash of (%s) %d with %d partitions => EE: %d, Java: %d\n",
                    VoltType.typeFromObject(valueToHash).toSQLString(),
                    valueToHash, partitionCount, eehash, javahash);
        }
        assertEquals(eehash, javahash);
        assertTrue(eehash < partitionCount);
        assertTrue(eehash > -1);
    }

    try { ee.release(); } catch (Exception e) {}
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:31,代码来源:TestTheHashinator.java

示例9: testSameStringHash

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
@Test
public void testSameStringHash() throws Exception {
    byte configBytes[] = TheHashinator.getConfigureBytes(1);
    ExecutionEngine ee =
            new ExecutionEngineJNI(
                    1,
                    1,
                    0,
                    0,
                    "",
                    100,
                    new HashinatorConfig(hashinatorType, configBytes, 0, 0));

    for (int i = 0; i < 1500; i++) {
        int partitionCount = r.nextInt(1000) + 1;
        configBytes = TheHashinator.getConfigureBytes(partitionCount);
        String valueToHash = Long.toString(r.nextLong());
        TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), configBytes);

        int eehash = ee.hashinate(valueToHash, TheHashinator.getCurrentConfig());
        int javahash = TheHashinator.getPartitionForParameter(VoltType.typeFromObject(valueToHash).getValue(),
                                                              valueToHash);
        if (eehash != javahash) {
            System.out.printf("Mismatched hash of (%s) %d with %d partitions => EE: %d, Java: %d\n",
                    VoltType.typeFromObject(valueToHash).toSQLString(),
                    valueToHash, partitionCount, eehash, javahash);
            partitionCount++;
        }
        assertEquals(eehash, javahash);
        assertTrue(eehash < partitionCount);
        assertTrue(eehash >= 0);
    }

    try { ee.release(); } catch (Exception e) {}
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:36,代码来源:TestTheHashinator.java

示例10: testSameBytesHash

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
@Test
public void testSameBytesHash() throws Exception {
    ExecutionEngine ee =
            new ExecutionEngineJNI(
                    1,
                    1,
                    0,
                    0,
                    "",
                    100,
                    new HashinatorConfig(hashinatorType, TheHashinator.getConfigureBytes(6), 0, 0));
    for (int i = 0; i < 2500; i++) {
        int partitionCount = r.nextInt(1000) + 1;
        byte[] valueToHash = new byte[r.nextInt(1000)];
        r.nextBytes(valueToHash);
        final byte configBytes[] = TheHashinator.getConfigureBytes(partitionCount);
        TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), configBytes);
        int eehash = ee.hashinate(valueToHash, TheHashinator.getCurrentConfig());
        int javahash = TheHashinator.getPartitionForParameter(VoltType.typeFromClass(byte[].class).getValue(),
                valueToHash);
        if (eehash != javahash) {
            System.out.printf("Mismatched hash of (%s) %d bytes %d partitions => EE: %d Java: %d\n",
                    VoltType.typeFromObject(valueToHash).toSQLString(),
                    valueToHash.length, partitionCount, eehash, javahash);
            partitionCount++;
        }
        assertTrue(eehash < partitionCount);
        assertTrue(eehash >= 0);
        assertEquals(eehash, javahash);
    }
    try { ee.release(); } catch (Exception e) {}
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:33,代码来源:TestTheHashinator.java

示例11: getExecutionEngine

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
public final ExecutionEngine getExecutionEngine() {
    return (this.ee);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:4,代码来源:PartitionExecutor.java

示例12: OptimisticConflictChecker

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
public OptimisticConflictChecker(CatalogContext catalogContext, ExecutionEngine ee) {
    super(catalogContext);
    this.ee = ee;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:5,代码来源:OptimisticConflictChecker.java

示例13: evictLRUfragment

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
private static void evictLRUfragment() {
    /// Evict the least recently used fragment (if any are currently unused).
    /// Along the way, update any obsolete entries that were left
    /// by the laziness of the fragment state changes (fragment reuse).
    /// In the rare case of a cache bloated beyond its usual limit,
    /// keep evicting as needed and as entries are available until the bloat is gone.

    while ( ! m_plansLRU.isEmpty()) {
        // Remove the earliest entry.
        Entry<Long, FragInfo> lru = m_plansLRU.pollFirstEntry();
        FragInfo frag = lru.getValue();
        if (frag.refCount > 0) {
            // The fragment is being re-used, it is no longer an eviction candidate.
            // It is only in the map due to the laziness in loadOrAddRefPlanFragment.
            // It will be re-considered (at a later key) once it is no longer referenced.
            // Resetting its lastUse to 0, here, restores it to a state identical to that
            // of a new fragment.
            // It eventually causes decrefPlanFragmentById to put it back in the map
            // at its then up-to-date key.
            // This makes it safe to keep out of the LRU map for now.
            // See the comment in decrefPlanFragmentById and the one in the next code block.
            frag.lastUse = 0;
        }
        else if (lru.getKey() != frag.lastUse) {
            // The fragment is not in use but has been re-used more recently than the key reflects.
            // This is a result of the laziness in decrefPlanFragmentById.
            // Correct the entry's key in the LRU map to reflect its last use.
            // This may STILL be the least recently used entry.
            // If so, it will be picked off in a later iteration of this loop;
            // its key will now match its lastUse value.
            m_plansLRU.put(frag.lastUse, frag);
        }
        else {
            // Found and removed the actual up-to-date least recently used entry from the LRU map.
            // Remove the entry from the other collections.
            m_plansById.remove(frag.fragId);
            m_plansByHash.remove(frag.hash);
            // Normally, one eviction for each new fragment is enough to restore order.
            // BUT, if a prior call ever failed to find an unused fragment in the cache,
            // the cache may have grown beyond its normal size. In that rare case,
            // one eviction is not enough to reduce the cache to the desired size,
            // so take another bite at the apple.
            // Otherwise, trading exactly one evicted fragment for each new fragment
            // would never reduce the cache.
            if (m_plansById.size() > ExecutionEngine.EE_PLAN_CACHE_SIZE) {
                 continue;
            }
            return;
        }
    }
    // Strange. All FragInfo entries appear to be in use. There's nothing to evict.
    // Let the cache bloat a little and try again later after the next new fragment.
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:54,代码来源:ActivePlanRepository.java

示例14: testSameLongHash1

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
@Test
public void testSameLongHash1() throws Exception {
    int partitionCount = 2;
    TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), TheHashinator.getConfigureBytes(partitionCount));
    HashinatorConfig hashinatorConfig = TheHashinator.getCurrentConfig();
    ExecutionEngine ee =
            new ExecutionEngineJNI(
                    1,
                    1,
                    0,
                    0,
                    "",
                    100,
                    hashinatorConfig);


    long valueToHash = 0;
    int eehash = ee.hashinate(valueToHash, hashinatorConfig);
    int javahash = TheHashinator.getPartitionForParameter(VoltType.typeFromObject(valueToHash).getValue(),
            valueToHash);
    if (eehash != javahash) {
        System.out.printf("Mismatched hash of (%s) %d with %d partitions => EE: %d, Java: %d\n",
                VoltType.typeFromObject(valueToHash).toSQLString(),
                valueToHash, partitionCount, eehash, javahash);
    }
    assertEquals(eehash, javahash);
    assertTrue(eehash < partitionCount);
    assertTrue(eehash >= 0);

    valueToHash = 1;
    eehash = ee.hashinate(valueToHash, hashinatorConfig);
    javahash = TheHashinator.getPartitionForParameter(VoltType.typeFromObject(valueToHash).getValue(),
            valueToHash);
    if (eehash != javahash) {
        System.out.printf("Mismatched hash of (%s) %d with %d partitions => EE: %d, Java: %d\n",
                VoltType.typeFromObject(valueToHash).toSQLString(),
                valueToHash, partitionCount, eehash, javahash);
    }
    assertEquals(eehash, javahash);
    assertTrue(eehash < partitionCount);
    assertTrue(eehash >= 0);

    valueToHash = 2;
    eehash = ee.hashinate(valueToHash, hashinatorConfig);
    javahash = TheHashinator.getPartitionForParameter(VoltType.typeFromObject(valueToHash).getValue(),
            valueToHash);
    if (eehash != javahash) {
        System.out.printf("Mismatched hash of (%s) %d with %d partitions => EE: %d, Java: %d\n",
                VoltType.typeFromObject(valueToHash).toSQLString(),
                valueToHash, partitionCount, eehash, javahash);
    }
    assertEquals(eehash, javahash);
    assertTrue(eehash < partitionCount);
    assertTrue(eehash >= 0);

    valueToHash = 3;
    eehash = ee.hashinate(valueToHash, hashinatorConfig);
    javahash = TheHashinator.getPartitionForParameter(VoltType.typeFromObject(valueToHash).getValue(),
            valueToHash);
    if (eehash != javahash) {
        System.out.printf("Mismatched hash of (%s) %d with %d partitions => EE: %d, Java: %d\n",
                VoltType.typeFromObject(valueToHash).toSQLString(),
                valueToHash, partitionCount, eehash, javahash);
    }
    assertEquals(eehash, javahash);
    assertTrue(eehash < partitionCount);
    assertTrue(eehash >= 0);

    try { ee.release(); } catch (Exception e) {}
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:71,代码来源:TestTheHashinator.java

示例15: testEdgeCases

import org.voltdb.jni.ExecutionEngine; //导入依赖的package包/类
@Test
public void testEdgeCases() throws Exception {
    byte configBytes[] = TheHashinator.getConfigureBytes(1);
    ExecutionEngine ee =
            new ExecutionEngineJNI(
                    1,
                    1,
                    0,
                    0,
                    "",
                    100,
                    new HashinatorConfig(hashinatorType, configBytes, 0, 0));

    /**
     *  Run with 100k of random values and make sure C++ and Java hash to
     *  the same value.
     */
    for (int i = 0; i < 500; i++) {
        int partitionCount = r.nextInt(1000) + 1;
        long[] values = new long[] {
                Long.MIN_VALUE, Long.MAX_VALUE, Long.MAX_VALUE - 1, Long.MIN_VALUE + 1
        };
        configBytes = TheHashinator.getConfigureBytes(partitionCount);
        TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), configBytes);
        for (long valueToHash : values) {
            int eehash = ee.hashinate(valueToHash, TheHashinator.getCurrentConfig());
            int javahash = TheHashinator.getPartitionForParameter(VoltType.typeFromObject(valueToHash).getValue(),
                    valueToHash);
            if (eehash != javahash) {
                System.out.printf("Mismatched hash of (%s) %d with %d partitions => EE: %d, Java: %d\n",
                        VoltType.typeFromObject(valueToHash).toSQLString(),
                        valueToHash, partitionCount, eehash, javahash);
            }
            assertEquals(eehash, javahash);
            assertTrue(eehash < partitionCount);
            assertTrue(eehash >= 0);
        }
    }

    try { ee.release(); } catch (Exception e) {}
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:42,代码来源:TestTheHashinator.java


注:本文中的org.voltdb.jni.ExecutionEngine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。