當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。