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


Java TxCacheMap类代码示例

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


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

示例1: main

import org.hypergraphdb.transaction.TxCacheMap; //导入依赖的package包/类
public static void main(String[] argv)
{
    TxCacheMapTest test = new TxCacheMapTest();
    test.setUp();        
    try
    {
        test.theMap = new TxCacheMap<Integer, SimpleData>(test.graph.getTransactionManager(), HashMap.class, null);
        //test.localMap = new TxMap<Integer, SimpleData>(test.graph.getTransactionManager(), null);
        test.runMe();
    }
    catch (Throwable t)
    {
        t.printStackTrace(System.err);
    }
    finally
    {
        test.tearDown();
    }
}
 
开发者ID:hypergraphdb,项目名称:hypergraphdb,代码行数:20,代码来源:TxCacheMapTest.java

示例2: WeakRefAtomCache

import org.hypergraphdb.transaction.TxCacheMap; //导入依赖的package包/类
public WeakRefAtomCache(HyperGraph graph)
{
    this.graph = graph;
    if (graph.getConfig().isTransactional())
    {
        atoms = atomsTx = new TxCacheMap<Object, HGLiveHandle>(
                                    graph.getTransactionManager(), 
                                    WeakIdentityHashMap.class,
                                    null);
        atomsTx.setReturnLatestAvailable(true);
           liveHandles = liveHandlesTx = new TxCacheMap<HGPersistentHandle, WeakHandle>(
                                       graph.getTransactionManager(), 
                                       HashMap.class,
                                       null); 	        
        frozenAtoms = new TxCacheMap<HGLiveHandle, Object>(graph.getTransactionManager(), null, null);
    }
    else
    {
        atoms = new HashCacheMap<Object, HGLiveHandle>(); // need a weak hash cache map?
        liveHandles = new HashCacheMap<HGPersistentHandle, WeakHandle>();
        frozenAtoms = new HashCacheMap<HGLiveHandle, Object>();
    }
	cleanupThread.setPriority(Thread.MAX_PRIORITY);
	cleanupThread.setDaemon(true);		
	cleanupThread.start();
}
 
开发者ID:armatys,项目名称:hypergraphdb-android,代码行数:27,代码来源:WeakRefAtomCache.java

示例3: setHyperGraph

import org.hypergraphdb.transaction.TxCacheMap; //导入依赖的package包/类
public void setHyperGraph(HyperGraph graph) 
{
       this.graph = graph;
       this.closing = false;
       if (graph.getConfig().isTransactional())
       {
           atoms = atomsTx = new TxCacheMap<Object, HGLiveHandle>(
                                       graph.getTransactionManager(), 
                                       WeakIdentityHashMap.class,
                                       null);
           atomsTx.setReturnLatestAvailable(true);
           liveHandles = liveHandlesTx = new TxCacheMap<HGPersistentHandle, WeakHandle>(
                                       graph.getTransactionManager(), 
                                       HashMap.class,
                                       null);          
           frozenAtoms = new TxCacheMap<HGLiveHandle, Object>(graph.getTransactionManager(), null, null);
       }
       else
       {
           atoms = new HashCacheMap<Object, HGLiveHandle>(); // need a weak hash cache map?
           liveHandles = new HashCacheMap<HGPersistentHandle, WeakHandle>();
           frozenAtoms = new HashCacheMap<HGLiveHandle, Object>();
       }
       cleanupThread = new PhantomCleanup();
       cleanupThread.setPriority(Thread.MAX_PRIORITY);
       cleanupThread.setDaemon(true);      
       cleanupThread.start();

	cleanupThread.setName("HGCACHE Cleanup - " + graph.getLocation());
}
 
开发者ID:hypergraphdb,项目名称:hypergraphdb,代码行数:31,代码来源:WeakRefAtomCache.java

示例4: initialize

import org.hypergraphdb.transaction.TxCacheMap; //导入依赖的package包/类
public void initialize(HyperGraph graph)
{
    this.graph = graph;
    this.classToAtomType = new TxCacheMap<Class<?>, HGHandle>(
            graph.getTransactionManager(), ClassToTypeCache.class, this);        
    classToAtomType.load(Top.class, graph.getHandleFactory().topTypeHandle()); // TOP is its own type
    classToAtomType.load(Object.class, graph.getHandleFactory().topTypeHandle()); // TOP also corresponds to the java.lang.Object "top type"
    classToAtomType.load(HGLink.class, graph.getHandleFactory().linkTypeHandle());
    classToAtomType.load(HGSubsumes.class, graph.getHandleFactory().subsumesTypeHandle());        
    if (!isPresent(graph))
    {
        PredefinedTypesConfig config = PredefinedTypesConfig.loadFromResource(graph.getHandleFactory(), 
                                                                              this.predefinedTypes);            
        for (HGPersistentHandle typeHandle : config.getHandles())
        {
            Class<? extends HGAtomType> cl = config.getTypeImplementation(typeHandle);
            if (cl.equals(Top.class) || 
                cl.equals(LinkType.class) ||  
                cl.equals(SubsumesType.class) ||
                cl.equals(NullType.class))
                continue;
            HGAtomType typeInstance = null;
            try { typeInstance = cl.newInstance(); }
            catch (Exception ex) { System.err.println("[HYPERGRAPHDB WARNING]: failed to create instance of type '" + 
                        cl.getName() + "'"); ex.printStackTrace(System.err); }
            List<Class<?>> targets = config.getMappedClasses(typeHandle);
            if (targets.isEmpty())
                graph.getTypeSystem().addPredefinedType(typeHandle, typeInstance, (URI)null);
            else for (Class<?> target : targets)
                graph.getTypeSystem().addPredefinedType(typeHandle, typeInstance, target);                
        }
    }
    javaTypes.setHyperGraph(graph);               
    
    // TODO : this is being initialized here because it causes a rather weird issue having to do
    // with the MVCC implementation if initialized on the spot (the first time it is needed). It 
    // causes the HGPlainLink.class HGDB type to have a null link pointing to it, presumably 
    // HGSubsumes that ends up being null (not in the store). There's some self-referentiality 
    // involved since AtomProjection is a bean, a RecordType and the RecordType implementation
    // does rely on the AtomProjection type being already defined. But before the MVCC this used
    // to work without a problem. Anyway, putting the initialization here fixed it, but it might
    // be just a workaround to a deeper problem that we haven't gotten to the bottom of. --Boris
    graph.getTypeSystem().getTypeHandle(AtomProjection.class);        
}
 
开发者ID:hypergraphdb,项目名称:hypergraphdb,代码行数:45,代码来源:JavaTypeSchema.java

示例5: HyperNodeJson

import org.hypergraphdb.transaction.TxCacheMap; //导入依赖的package包/类
/**
 * <p>Create a view of the JSON within the given <code>HyperGraphDB</code> instance. Note that
 * it is strongly recommended to have only one such view instantiated per database instance because
 * it maintains its own cache of <code>Json</code> atoms and multiple views may lead to inconsistencies
 * as the caches won't be automatically synchronized.
 * </p> 
 * @param graph
 */
public HyperNodeJson(HyperGraph graph)
{
    this.graph = graph;
    atomsTx = new TxCacheMap<Object, HGLiveHandle>(graph.getTransactionManager(), WeakIdentityHashMap.class, null);
    makeQueries();
}
 
开发者ID:hypergraphdb,项目名称:mjson,代码行数:15,代码来源:HyperNodeJson.java


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