Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
Neo4j kernel is a lightweight, embedded Java database designed to
store data structured as graphs rather than tables. For more
information, see http://neo4j.org.
/**
* Copyright (c) 2002-2013 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package org.neo4j.kernel.impl.persistence;
import java.util.Map;
import javax.transaction.RollbackException;
import javax.transaction.Status;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.xa.XAResource;
import org.neo4j.graphdb.NotInTransactionException;
import org.neo4j.graphdb.TransactionFailureException;
import org.neo4j.helpers.Pair;
import org.neo4j.kernel.impl.core.PropertyIndex;
import org.neo4j.kernel.impl.core.TransactionEventsSyncHook;
import org.neo4j.kernel.impl.core.TransactionState;
import org.neo4j.kernel.impl.core.TxEventSyncHookFactory;
import org.neo4j.kernel.impl.nioneo.store.NameData;
import org.neo4j.kernel.impl.nioneo.store.NodeRecord;
import org.neo4j.kernel.impl.nioneo.store.PropertyData;
import org.neo4j.kernel.impl.nioneo.store.RelationshipRecord;
import org.neo4j.kernel.impl.nioneo.xa.NioNeoDbPersistenceSource;
import org.neo4j.kernel.impl.transaction.AbstractTransactionManager;
import org.neo4j.kernel.impl.transaction.xaframework.XaConnection;
import org.neo4j.kernel.impl.util.ArrayMap;
import org.neo4j.kernel.impl.util.RelIdArray;
import org.neo4j.kernel.impl.util.RelIdArray.DirectionWrapper;
import org.neo4j.kernel.impl.util.StringLogger;
public class PersistenceManager
{
private final PersistenceSource persistenceSource;
private final StringLogger msgLog;
private final AbstractTransactionManager transactionManager;
private final ArrayMap txConnectionMap =
new ArrayMap( (byte)5, true, true );
private final TxEventSyncHookFactory syncHookFactory;
public PersistenceManager( StringLogger msgLog, AbstractTransactionManager transactionManager,
PersistenceSource persistenceSource,
TxEventSyncHookFactory syncHookFactory )
{
this.msgLog = msgLog;
this.transactionManager = transactionManager;
this.persistenceSource = persistenceSource;
this.syncHookFactory = syncHookFactory;
}
public NodeRecord loadLightNode( long id )
{
return getReadOnlyResourceIfPossible().nodeLoadLight( id );
}
public Object loadPropertyValue( PropertyData property )
{
return getReadOnlyResource().loadPropertyValue( property );
}
public String loadIndex( int id )
{
return getReadOnlyResourceIfPossible().loadIndex( id );
}
public NameData[] loadPropertyIndexes( int maxCount )
{
/* Using getReadOnlyResource here since loadPropertyIndexes doesn't
* follow transaction state visibility standard anyway. There's also
* an issue where this is called right after the neostore data source
* has been started, but potentially before all recovery has been
* done on all data sources, meaning that a call to getTransaction
* could fail.
*/
return getReadOnlyResource/*IfPossible*/().loadPropertyIndexes( maxCount );
}
public long getRelationshipChainPosition( long nodeId )
{
return getReadOnlyResourceIfPossible().getRelationshipChainPosition( nodeId );
}
public Pair