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.
/*
* Copyright (c) 2002-2024 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.neo4j.ogm.transaction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import org.neo4j.ogm.exception.TransactionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author vince
*/
public abstract class AbstractTransaction implements Transaction {
private final Logger logger = LoggerFactory.getLogger(Transaction.class);
protected final TransactionManager transactionManager;
/* Neo4j does not support nested transactions, but it does allow a transaction to be declared in the context of
* another one. These 'placebo' transactions only have an effect if their unit of work is rolled back, in which
* case the entire transaction will be rolled back. In the OGM they are modelled as extensions to the top-level
* transaction, and managed via a simple extension counter. Every new transaction increments the counter, every
* rollback or commit decrements the counter. Rollback/Commit only get executed when the counter = 0, but a
* rollback of an extension will mark the entire transaction to be rolled back, and an attempt to commit such
* a transaction will fail.
*/
private final AtomicLong extendsCount = new AtomicLong();
/* Objects which are newly persisted into the graph should be registered on the transaction.
* In the event that a rollback occurs, these objects will have been assigned an id from the database
* but will be deleted from the graph, so we can reset their ids to null, in order to allow
* a subsequent save request to operate correctly */
private final List