internal void BeginCommit(
            InternalTransaction internalTransaction
            )
        {
            if ( DiagnosticTrace.Verbose )
            {
                MethodEnteredTraceRecord.Trace( SR.GetString( SR.TraceSourceOletx ),
                    "CommittableTransaction.BeginCommit"
                    );
                TransactionCommitCalledTraceRecord.Trace( SR.GetString( SR.TraceSourceOletx ),
                    this.TransactionTraceId
                    );
            }

            Debug.Assert( ( 0 == this.disposed ), "OletxTransction object is disposed" );
            this.realOletxTransaction.InternalTransaction = internalTransaction;
            
            this.commitCalled = true;

            this.realOletxTransaction.Commit();

            if ( DiagnosticTrace.Verbose )
            {
                MethodExitedTraceRecord.Trace( SR.GetString( SR.TraceSourceOletx ),
                    "CommittableTransaction.BeginCommit"
                    );
            }

            return;
        }
        public void RollbackInternal()
        {
            if (HasBeenCommitted)
            {
                throw new SoftwareException("Transaction has already been committed.");
            }

            InternalTransaction.Rollback();
            HasBeenRolledBack = true;
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotBeTopLevelWithExplicitTx()
        public virtual void ShouldNotBeTopLevelWithExplicitTx()
        {
            InternalTransaction tx = mock(typeof(InternalTransaction));

            when(tx.TransactionType()).thenReturn(KernelTransaction.Type.@explicit);

            Neo4jTransactionalContext context = NewContext(tx);

            assertFalse(context.TopLevelTx);
        }
Esempio n. 4
0
 private ThreadStart StartAnotherTransaction()
 {
     return(() =>
     {
         using (InternalTransaction ignored = Database.beginTransaction(KernelTransaction.Type.@implicit, LoginContext.AUTH_DISABLED, 1, TimeUnit.SECONDS))
         {
             Node node = Database.getNodeById(NODE_ID);
             node.setProperty("c", "d");
         }
     });
 }
Esempio n. 5
0
        private Result Execute(LoginContext subject, string query, IDictionary <string, object> @params)
        {
            Result result;

            using (InternalTransaction tx = _db.beginTransaction(@explicit, subject))
            {
                result = _db.execute(tx, query, ValueUtils.asMapValue(@params));
                result.ResultAsString();
                tx.Success();
            }
            return(result);
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBePossibleToTerminateWithoutActiveTransaction()
        public virtual void ShouldBePossibleToTerminateWithoutActiveTransaction()
        {
            InternalTransaction       tx      = mock(typeof(InternalTransaction));
            Neo4jTransactionalContext context = NewContext(tx);

            context.Close(true);
            verify(tx).success();
            verify(tx).close();

            context.Terminate();
            verify(tx, never()).terminate();
        }
        private void CheckNotTerminated()
        {
            InternalTransaction currentTransaction = _transaction;

            if (currentTransaction != null)
            {
                currentTransaction.TerminationReason().ifPresent(status =>
                {
                    throw new TransactionTerminatedException(status);
                });
            }
        }
Esempio n. 8
0
        private void Execute(LoginContext subject, string query, IDictionary <string, object> @params, System.Action <Result> consumer)
        {
            Result result;

            using (InternalTransaction tx = _db.beginTransaction(@explicit, subject))
            {
                result = _db.execute(tx, query, ValueUtils.asMapValue(@params));
                consumer(result);
                tx.Success();
                result.Close();
            }
        }
Esempio n. 9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.util.List<LockOperationRecord> traceQueryLocks(String query, LockOperationListener... listeners) throws org.neo4j.kernel.impl.query.QueryExecutionKernelException
        private IList <LockOperationRecord> TraceQueryLocks(string query, params LockOperationListener[] listeners)
        {
            GraphDatabaseQueryService graph           = DatabaseRule.resolveDependency(typeof(GraphDatabaseQueryService));
            QueryExecutionEngine      executionEngine = DatabaseRule.resolveDependency(typeof(QueryExecutionEngine));

            using (InternalTransaction tx = graph.BeginTransaction(KernelTransaction.Type.@implicit, LoginContext.AUTH_DISABLED))
            {
                TransactionalContextWrapper context = new TransactionalContextWrapper(CreateTransactionContext(graph, tx, query), listeners);
                executionEngine.ExecuteQuery(query, VirtualValues.emptyMap(), context);
                return(new List <LockOperationRecord>(context.RecordingLocks.LockOperationRecords));
            }
        }
Esempio n. 10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotCloseTransactionDuringTermination()
        public virtual void ShouldNotCloseTransactionDuringTermination()
        {
            InternalTransaction tx = mock(typeof(InternalTransaction));

            when(tx.TransactionType()).thenReturn(KernelTransaction.Type.@implicit);

            Neo4jTransactionalContext context = NewContext(tx);

            context.Terminate();

            verify(tx).terminate();
            verify(tx, never()).close();
        }
Esempio n. 11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotListAnyQueriesIfNotAuthenticated()
        public virtual void ShouldNotListAnyQueriesIfNotAuthenticated()
        {
            EnterpriseLoginContext unAuthSubject = CreateFakeAnonymousEnterpriseLoginContext();
            GraphDatabaseFacade    graph         = Neo.LocalGraph;

            using (InternalTransaction tx = graph.BeginTransaction(KernelTransaction.Type.@explicit, unAuthSubject))
            {
                Result result = graph.execute(tx, "CALL dbms.listQueries", EMPTY_MAP);
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertFalse(result.HasNext());
                tx.Success();
            }
        }
Esempio n. 12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotBePossibleToCloseMultipleTimes()
        public virtual void ShouldNotBePossibleToCloseMultipleTimes()
        {
            InternalTransaction       tx      = mock(typeof(InternalTransaction));
            Neo4jTransactionalContext context = NewContext(tx);

            context.Close(false);
            context.Close(true);
            context.Close(false);

            verify(tx).failure();
            verify(tx, never()).success();
            verify(tx).close();
        }
Esempio n. 13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWarnWhenUsingInternalAndOtherProvider() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWarnWhenUsingInternalAndOtherProvider()
        {
            ConfiguredSetup(stringMap(SecuritySettings.auth_providers.name(), InternalSecurityName() + " ,LDAP"));
            AssertSuccess(AdminSubject, "CALL dbms.security.listUsers", r => assertKeyIsMap(r, "username", "roles", ValueOf(_userList)));
            GraphDatabaseFacade localGraph  = Neo.LocalGraph;
            InternalTransaction transaction = localGraph.BeginTransaction(KernelTransaction.Type.@explicit, StandardEnterpriseLoginContext.AUTH_DISABLED);
            Result result      = localGraph.execute(transaction, "EXPLAIN CALL dbms.security.listUsers", EMPTY_MAP);
            string description = string.Format("{0} ({1})", Org.Neo4j.Kernel.Api.Exceptions.Status_Procedure.ProcedureWarning.code().description(), "dbms.security.listUsers only applies to native users.");

            assertThat(ContainsNotification(result, description), equalTo(true));
            transaction.Success();
            transaction.Close();
        }
Esempio n. 14
0
        public Neo4jTransactionalContext(GraphDatabaseQueryService graph, ThreadToStatementContextBridge txBridge, PropertyContainerLocker locker, InternalTransaction initialTransaction, Statement initialStatement, ExecutingQuery executingQuery, Kernel kernel)
        {
            this._graph                  = graph;
            this._txBridge               = txBridge;
            this._locker                 = locker;
            this.TransactionType         = initialTransaction.TransactionType();
            this.SecurityContextConflict = initialTransaction.SecurityContext();
            this._executingQuery         = executingQuery;

            this._transaction       = initialTransaction;
            this._kernelTransaction = txBridge.GetKernelTransactionBoundToThisThread(true);
            this._statement         = initialStatement;
            this._kernel            = kernel;
        }
Esempio n. 15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogTXMetaDataInQueryLog() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogTXMetaDataInQueryLog()
        {
            // turn on query logging
            _databaseBuilder.setConfig(logs_directory, _logsDirectory.Path);
            _databaseBuilder.setConfig(log_queries, Settings.TRUE);
            _db = new EmbeddedInteraction(_databaseBuilder, Collections.emptyMap());
            GraphDatabaseFacade graph = _db.LocalGraph;

            _db.LocalUserManager.setUserPassword("neo4j", password("123"), false);

            EnterpriseLoginContext subject = _db.login("neo4j", "123");

            _db.executeQuery(subject, "UNWIND range(0, 10) AS i CREATE (:Foo {p: i})", Collections.emptyMap(), ResourceIterator.close);

            // Set meta data and execute query in transaction
            using (InternalTransaction tx = _db.beginLocalTransactionAsUser(subject, KernelTransaction.Type.@explicit))
            {
                graph.Execute("CALL dbms.setTXMetaData( { User: '******' } )", Collections.emptyMap());
                graph.Execute("CALL dbms.procedures() YIELD name RETURN name", Collections.emptyMap()).close();
                graph.Execute("MATCH (n) RETURN n", Collections.emptyMap()).close();
                graph.Execute(QUERY, Collections.emptyMap());
                tx.Success();
            }

            // Ensure that old meta data is not retained
            using (InternalTransaction tx = _db.beginLocalTransactionAsUser(subject, KernelTransaction.Type.@explicit))
            {
                graph.Execute("CALL dbms.setTXMetaData( { Location: 'Sweden' } )", Collections.emptyMap());
                graph.Execute("MATCH ()-[r]-() RETURN count(r)", Collections.emptyMap()).close();
                tx.Success();
            }

            _db.tearDown();

            // THEN
            IList <string> logLines = ReadAllLines(_logFilename);

            assertThat(logLines, hasSize(7));
            assertThat(logLines[0], not(containsString("User: '******'")));
            // we don't care if setTXMetaData contains the meta data
            //assertThat( logLines.get( 1 ), containsString( "User: Johan" ) );
            assertThat(logLines[2], containsString("User: '******'"));
            assertThat(logLines[3], containsString("User: '******'"));
            assertThat(logLines[4], containsString("User: '******'"));

            // we want to make sure that the new transaction does not carry old meta data
            assertThat(logLines[5], not(containsString("User: '******'")));
            assertThat(logLines[6], containsString("Location: 'Sweden'"));
        }
Esempio n. 16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void checkKernelStatementOnCheck()
        public virtual void CheckKernelStatementOnCheck()
        {
            InternalTransaction initialTransaction = mock(typeof(InternalTransaction), new ReturnsDeepStubs());
            Kernel kernel = mock(typeof(Kernel));
            ThreadToStatementContextBridge txBridge = mock(typeof(ThreadToStatementContextBridge));
            KernelTransaction kernelTransaction     = MockTransaction(_initialStatement);

            when(txBridge.GetKernelTransactionBoundToThisThread(true)).thenReturn(kernelTransaction);

            Neo4jTransactionalContext transactionalContext = new Neo4jTransactionalContext(null, txBridge, null, initialTransaction, _initialStatement, null, kernel);

            transactionalContext.Check();

            verify(kernelTransaction).assertOpen();
        }
 internal void BeginCommit(InternalTransaction internalTransaction)
 {
     if (DiagnosticTrace.Verbose)
     {
         MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "CommittableTransaction.BeginCommit");
         TransactionCommitCalledTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.TransactionTraceId);
     }
     base.realOletxTransaction.InternalTransaction = internalTransaction;
     this.commitCalled = true;
     base.realOletxTransaction.Commit();
     if (DiagnosticTrace.Verbose)
     {
         MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "CommittableTransaction.BeginCommit");
     }
 }
Esempio n. 18
0
        private static Optional <MultiClusterRoutingResult> CallProcedure(CoreGraphDatabase db, ProcedureNames procedure, IDictionary <string, object> @params)
        {
            Optional <MultiClusterRoutingResult> routingResult = null;

            using (InternalTransaction tx = Db.beginTransaction(KernelTransaction.Type.@explicit, EnterpriseLoginContext.AUTH_DISABLED), Result result = Db.execute(tx, "CALL " + procedure.callName(), ValueUtils.asMapValue(@params)))
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                if (result.HasNext())
                {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    routingResult = MultiClusterRoutingResultFormat.parse(result.Next());
                }
            }
            return(routingResult);
        }
Esempio n. 19
0
 // Create a transaction with the given settings
 //
 internal DependentTransaction(IsolationLevel isoLevel, InternalTransaction internalTransaction, bool blocking) :
     base(isoLevel, internalTransaction)
 {
     _blocking = blocking;
     lock (_internalTransaction)
     {
         if (blocking)
         {
             _internalTransaction.State.CreateBlockingClone(_internalTransaction);
         }
         else
         {
             _internalTransaction.State.CreateAbortingClone(_internalTransaction);
         }
     }
 }
Esempio n. 20
0
 // Create a transaction with the given settings
 //
 internal DependentTransaction(IsolationLevel isoLevel, InternalTransaction internalTransaction, bool blocking)
     : base(isoLevel, internalTransaction)
 {
     _blocking = blocking;
     lock (_internalTransaction)
     {
         if (blocking)
         {
             _internalTransaction.State.CreateBlockingClone(_internalTransaction);
         }
         else
         {
             _internalTransaction.State.CreateAbortingClone(_internalTransaction);
         }
     }
 }
Esempio n. 21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void coreProceduresShouldBeAvailable()
        public virtual void CoreProceduresShouldBeAvailable()
        {
            string[] coreProcs = new string[] { "dbms.cluster.role", "dbms.cluster.routing.getServers", "dbms.cluster.overview", "dbms.procedures", "dbms.listQueries" };

            foreach (string procedure in coreProcs)
            {
                Optional <CoreClusterMember> firstCore = _cluster.coreMembers().First();
                Debug.Assert(firstCore.Present);
                CoreGraphDatabase   database = firstCore.get().database();
                InternalTransaction tx       = database.BeginTransaction(KernelTransaction.Type.@explicit, AUTH_DISABLED);
                Result coreResult            = database.Execute("CALL " + procedure + "()");
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue("core with procedure " + procedure, coreResult.HasNext());
                coreResult.Close();
                tx.Close();
            }
        }
Esempio n. 22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBePossibleToCloseAfterTermination()
        public virtual void ShouldBePossibleToCloseAfterTermination()
        {
            InternalTransaction tx = mock(typeof(InternalTransaction));

            when(tx.TransactionType()).thenReturn(KernelTransaction.Type.@implicit);

            Neo4jTransactionalContext context = NewContext(tx);

            context.Terminate();

            verify(tx).terminate();
            verify(tx, never()).close();

            context.Close(false);
            verify(tx).failure();
            verify(tx).close();
        }
Esempio n. 23
0
        private LoadBalancingResult GetServers(CoreGraphDatabase db, IDictionary <string, string> context)
        {
            LoadBalancingResult lbResult = null;

            using (InternalTransaction tx = Db.beginTransaction(KernelTransaction.Type.@explicit, EnterpriseLoginContext.AUTH_DISABLED))
            {
                IDictionary <string, object> parameters = MapUtil.map(ParameterNames.CONTEXT.parameterName(), context);
                using (Result result = Db.execute(tx, "CALL " + GET_SERVERS_V2.callName(), ValueUtils.asMapValue(parameters)))
                {
                    while (result.MoveNext())
                    {
                        lbResult = ResultFormatV1.parse(result.Current);
                    }
                }
            }
            return(lbResult);
        }
Esempio n. 24
0
		 private IList<IList<string>> GetServerGroups( CoreGraphDatabase db )
		 {
			  IList<IList<string>> serverGroups = new List<IList<string>>();
			  using ( InternalTransaction tx = Db.beginTransaction( KernelTransaction.Type.@explicit, EnterpriseLoginContext.AUTH_DISABLED ) )
			  {
					using ( Result result = Db.execute( tx, "CALL dbms.cluster.overview", EMPTY_MAP ) )
					{
						 while ( result.MoveNext() )
						 {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<String> groups = (java.util.List<String>) result.Current.get("groups");
							  IList<string> groups = ( IList<string> ) result.Current.get( "groups" );
							  serverGroups.Add( groups );
						 }
					}
			  }
			  return serverGroups;
		 }
Esempio n. 25
0
 public override Exception apply(S subject)
 {
     try
     {
         using (InternalTransaction tx = _outerInstance.neo.beginLocalTransactionAsUser(subject, _txType))
         {
             Result result = null;
             try
             {
                 if (_startEarly)
                 {
                     _outerInstance.latch.start();
                 }
                 foreach (string query in _queries)
                 {
                     if (result != null)
                     {
                         result.Close();
                     }
                     result = _outerInstance.neo.LocalGraph.execute(query);
                 }
                 if (!_startEarly)
                 {
                     _outerInstance.latch.startAndWaitForAllToStart();
                 }
             }
             finally
             {
                 if (!_startEarly)
                 {
                     _outerInstance.latch.start();
                 }
                 _outerInstance.latch.finishAndWaitForAllToFinish();
             }
             result.Close();
             tx.Success();
             return(null);
         }
     }
     catch (Exception t)
     {
         return(t);
     }
 }
Esempio n. 26
0
        private async Task <Sp8deTransaction> CreateTransaction(int secret, Sp8deTransactionType type, string dependsOn = null)
        {
            var innerItems = new List <InternalTransaction>();

            for (int i = 0; i < keys.Length; i++)
            {
                var key = keys[i];

                var internalTx = new InternalTransaction()
                {
                    Nonce = ((secret + i) * 3).ToString(),
                    From  = key.PublicAddress,
                    Data  = (secret / (i + 3) + i).ToString()
                };

                internalTx.Sign = cryptoService.SignMessage(internalTx.GetDataForSign(), key.PrivateKey);

                switch (type)
                {
                case Sp8deTransactionType.AggregatedCommit:
                    internalTx.Type = Sp8deTransactionType.InternalContributor + i;
                    internalTx.Data = null;     //cleanup secret data
                    break;

                case Sp8deTransactionType.AggregatedReveal:
                    internalTx.Type = Sp8deTransactionType.InternalContributor + i;
                    break;

                default:
                    throw new ArgumentException(nameof(type));
                }

                innerItems.Add(internalTx);
            }

            var tx = await transactionService.AddTransaction(new CreateTransactionRequest()
            {
                DependsOn         = dependsOn,
                InnerTransactions = innerItems,
                Type = type
            });

            return(tx);
        }
Esempio n. 27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void readReplicaProceduresShouldBeAvailable()
        public virtual void ReadReplicaProceduresShouldBeAvailable()
        {
            // given
            string[] readReplicaProcs = new string[] { "dbms.cluster.role", "dbms.procedures", "dbms.listQueries" };

            // when
            foreach (string procedure in readReplicaProcs)
            {
                Optional <ReadReplica> firstReadReplica = _cluster.readReplicas().First();
                Debug.Assert(firstReadReplica.Present);
                ReadReplicaGraphDatabase database = firstReadReplica.get().database();
                InternalTransaction      tx       = database.BeginTransaction(KernelTransaction.Type.@explicit, AUTH_DISABLED);
                Result readReplicaResult          = database.Execute("CALL " + procedure + "()");

                // then
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue("read replica with procedure " + procedure, readReplicaResult.HasNext());
                readReplicaResult.Close();
                tx.Close();
            }
        }
    internal void BeginCommit(InternalTransaction internalTransaction)
    {
        TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;

        if (etwLog.IsEnabled())
        {
            etwLog.MethodEnter(TraceSourceType.TraceSourceOleTx, this);
            etwLog.TransactionCommit(TraceSourceType.TraceSourceOleTx, TransactionTraceId, "CommittableTransaction");
        }

        Debug.Assert(0 == Disposed, "OletxTransction object is disposed");
        RealOletxTransaction.InternalTransaction = internalTransaction;

        _commitCalled = true;

        RealOletxTransaction.Commit();

        if (etwLog.IsEnabled())
        {
            etwLog.MethodExit(TraceSourceType.TraceSourceOleTx, this, $"{nameof(OletxCommittableTransaction)}.{nameof(BeginCommit)}");
        }
    }
Esempio n. 29
0
        private void SetUpMocks()
        {
            _queryService = mock(typeof(GraphDatabaseQueryService));
            DependencyResolver resolver = mock(typeof(DependencyResolver));

            _txBridge         = mock(typeof(ThreadToStatementContextBridge));
            _initialStatement = mock(typeof(KernelStatement));

            _statistics = new ConfiguredExecutionStatistics(this);
            QueryRegistryOperations queryRegistryOperations = mock(typeof(QueryRegistryOperations));
            InternalTransaction     internalTransaction     = mock(typeof(InternalTransaction));

            when(internalTransaction.TerminationReason()).thenReturn(null);

            when(_initialStatement.queryRegistration()).thenReturn(queryRegistryOperations);
            when(_queryService.DependencyResolver).thenReturn(resolver);
            when(resolver.ResolveDependency(typeof(ThreadToStatementContextBridge))).thenReturn(_txBridge);
            when(_queryService.beginTransaction(any(), any())).thenReturn(internalTransaction);

            KernelTransaction mockTransaction = mockTransaction(_initialStatement);

            when(_txBridge.get()).thenReturn(_initialStatement);
            when(_txBridge.getKernelTransactionBoundToThisThread(true)).thenReturn(mockTransaction);
        }
Esempio n. 30
0
 internal void BeginCommit(InternalTransaction tx)
 {
     throw NotSupported();
 }
Esempio n. 31
0
 internal TransactionInformation(InternalTransaction internalTransaction)
 {
     _internalTransaction = internalTransaction;
 }
Esempio n. 32
0
        // Common constructor used by all types of constructors
        // Create a clean and fresh transaction.
        internal RealOletxTransaction(OletxTransactionManager transactionManager, 
            ITransactionShim transactionShim,
            OutcomeEnlistment outcomeEnlistment,
            Guid identifier,
            OletxTransactionIsolationLevel oletxIsoLevel,
            bool isRoot )
        {
            bool successful = false;

            try
            {
                // initialize the member fields
                this.oletxTransactionManager = transactionManager;
                this.transactionShim = transactionShim;
                this.outcomeEnlistment = outcomeEnlistment;
                this.txGuid = identifier;
                this.isolationLevel = OletxTransactionManager.ConvertIsolationLevelFromProxyValue( oletxIsoLevel );
                this.status = TransactionStatus.Active;
                this.undisposedOletxTransactionCount = 0;
                this.phase0EnlistVolatilementContainerList = null;
                this.phase1EnlistVolatilementContainer = null;
                this.tooLateForEnlistments = false;
                this.internalTransaction = null;

                this.creationTime = DateTime.UtcNow;
                this.lastStateChangeTime = this.creationTime;

                // Connect this object with the OutcomeEnlistment.
                this.internalClone = new OletxTransaction( this );

                // We have have been created without an outcome enlistment if it was too late to create
                // a clone from the ITransactionNative that we were created from.
                if ( null != this.outcomeEnlistment )
                {
                    this.outcomeEnlistment.SetRealTransaction( this );
                }
                else
                {
                    this.status = TransactionStatus.InDoubt;
                }

                if ( DiagnosticTrace.HaveListeners )
                {
                    DiagnosticTrace.TraceTransfer(this.txGuid);
                }

                successful = true;
            }
            finally
            {
                if (!successful)
                {
                    if (this.outcomeEnlistment != null)
                    {
                        this.outcomeEnlistment.UnregisterOutcomeCallback();
                        this.outcomeEnlistment = null;
                    }
                }
            }
               
        }
Esempio n. 33
0
 internal TransactionInformation(InternalTransaction internalTransaction)
 {
     _internalTransaction = internalTransaction;
 }
Esempio n. 34
0
 internal void BeginCommit(InternalTransaction tx)
 {
     throw NotSupported();
 }
Esempio n. 35
0
 private Neo4jTransactionalContext NewContext(InternalTransaction initialTx)
 {
     return(new Neo4jTransactionalContext(_queryService, _txBridge, new PropertyContainerLocker(), initialTx, _initialStatement, null, null));
 }