Create a <code>Transaction</code> object and associate it with the current thread.
@return The newly created <code>Transaction</code> instance.
@see Transaction
187218
public Transaction newTransaction()
    {
        if ((getCurrentDatabase() == null))
        {
            throw new DatabaseClosedException("Database is NULL, must have a DB in order to create a transaction");
        }
        TransactionImpl tx = new TransactionImpl(this);
        try
        {
            getConfigurator().configure(tx);
        }
        catch (ConfigurationException e)
        {
            throw new ODMGRuntimeException("Error in configuration of TransactionImpl instance: " + e.getMessage());
        }
        return tx;
    }
763190
public <R> R withCommitTransaction(TransFunc<R> transFunc) throws IOException {
    return withTransaction(transFunc, true);
  }
716820
public function create()
    {
        $instance = self::createPaymentTransaction($this);
        $this->setId($instance->getId());
        return $instance;
    }
294693
public static <T,R> TransactionFlow<T,R> of(TransactionTemplate transactionManager,Function<T,R> fn){
		return new TransactionFlow<>(transactionManager,fn);
	}
683310
public static Transaction suspend()
   {
      try {
         Transaction suspend = transactionManager.suspend();
         return suspend;
      }
      catch (SystemException e) {
         throw new RuntimeException("Unable to suspend current transaction", e);
      }
   }
1072790
def make_transaction(self):
        
        if self.pk:
            raise CannotRecreateTransactionOnRecurredCost(
                'The transaction for this recurred cost has already been created. You cannot create it again.'
            )

        amount = self.recurring_cost.get_amount(self.billing_cycle)

        # It is quite possible that there will be nothing to bill, in which
        # case we cannot create a transaction with no legs, nor can we create
        # legs with zero values. Therefore we don't create any transaction.
        if not amount:
            return None

        self.transaction = Transaction.objects.create(
            description='Created by recurring cost',
            date=self.billing_cycle.date_range.lower
        )

        # Use the SplitManager's custom queryset's split() method to get the
        # amount to be billed for each split
        splits = self.recurring_cost.splits.all().split(amount)

        # Create the transaction leg for the outbound funds
        # (normally to an expense account)
        self.transaction.legs.add(Leg.objects.create(
            transaction=self.transaction,
            amount=Money(amount, self.recurring_cost.currency),
            account=self.recurring_cost.to_account,
        ))

        for split, split_amount in splits:
            # Create the transaction legs for the inbound funds
            # (from housemate accounts)
            if split_amount:
                self.transaction.legs.add(Leg.objects.create(
                    transaction=self.transaction,
                    amount=Money(split_amount * -1, self.recurring_cost.currency),
                    account=split.from_account,
                ))

        return self.transaction
1366711
public Object doGetTransaction() throws TransactionException {
		CompensatingTransactionHolderSupport holder = (CompensatingTransactionHolderSupport) TransactionSynchronizationManager
				.getResource(getTransactionSynchronizationKey());
        return new CompensatingTransactionObject(holder);
	}
634635
public Future<Void> commit(){
        if(!(delegate instanceof PgTransaction)){
            throw new IllegalStateException("Not in transaction");
        }
        Future<Void> commit = Future.future();
        ((PgTransaction) delegate).commit(commit);
        return commit;
    }
754096
public ExternalAutoCommitTransaction createAutoCommitTransaction() 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "createAutoCommitTransaction");

    ExternalAutoCommitTransaction transaction = 
      transactionFactory.createAutoCommitTransaction();

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createAutoCommitTransaction", transaction);

    return transaction;
  }
1239279
public synchronized Object lastKey(Transaction transaction)
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "lastKey",
                        new Object[] { transaction });

        Entry entry = lastEntry(transaction);
        Object returnKey = entry.getKey();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "lastKey",
                       new Object[] { returnKey });
        return returnKey;
    }
415411
@Override
    public Transaction makeTransaction(byte[] payloadBytes, int offset, int length, byte[] hashFromHeader)
            throws ProtocolException {
        return new Transaction(params, payloadBytes, offset, null, this, length, hashFromHeader);
    }
1175169
public Transaction getTransaction() {
        try {
            return getTransactionManager().getTransaction();
        }
        catch (Exception ex) {
            StandardLogger logger = LoggerUtil.getStandardLogger();
            logger.severeException(ex.getMessage(), ex);
            return null;
        }
    }
765090
public TransactionQueueData add(TransactionQueueData data) {
        return new TransactionQueueData
            (null,
             Math.min(mSnapshotStart, data.mSnapshotStart),
             Math.max(mSnapshotEnd, data.mSnapshotEnd),
             mQueueSize + data.mQueueSize,
             mThreadCount + data.mThreadCount,
             mServicingCount + data.mServicingCount,
             Math.max(mPeakQueueSize, data.mPeakQueueSize),
             Math.max(mPeakThreadCount, data.mPeakThreadCount),
             Math.max(mPeakServicingCount, data.mPeakServicingCount),
             mTotalEnqueueAttempts + data.mTotalEnqueueAttempts,
             mTotalEnqueued + data.mTotalEnqueued,
             mTotalServiced + data.mTotalServiced,
             mTotalExpired + data.mTotalExpired,
             mTotalServiceExceptions + data.mTotalServiceExceptions,
             mTotalUncaughtExceptions + data.mTotalUncaughtExceptions,
             mTotalQueueDuration + data.mTotalQueueDuration,
             mTotalServiceDuration + data.mTotalServiceDuration
             );
    }
861166
public <K, T extends Persistable<K>>
    K create(
                    final Class<T> type,
                    final T object
                    )
    {
        K  p_id = _executeTx( "create", type, object,
                        new TransactionCallback<K>()
                        {
                            public K doInTransaction( final TransactionStatus status )
                            {
                                return getDao( type ).create( object );
                            }
                        }
        );

        return p_id;
    }
445634
def create_transaction(self, *args: Any, **kwargs: Any) -> BaseTransaction:
        
        return self.get_vm().create_transaction(*args, **kwargs)
1167173
private SynchronizationAdapter createSynchronizationAdapter(Transaction transaction) {
      SynchronizationAdapter adapter = new SynchronizationAdapter(transaction, RemoteXid.create(uuid));
      try {
         transaction.registerSynchronization(adapter);
      } catch (RollbackException | SystemException e) {
         throw new CacheException(e);
      }
      if (trace) {
         log.tracef("Registered synchronization for transaction %s. Sync=%s", transaction, adapter);
      }
      return adapter;
   }
866811
public static TransactionContext getTransactionContext(HazelcastInstance hazelcastInstance) {
        TransactionContextHolder transactionContextHolder =
                (TransactionContextHolder) TransactionSynchronizationManager.getResource(hazelcastInstance);
        if (transactionContextHolder == null) {
            throw new NoTransactionException("No TransactionContext with actual transaction available for current thread");
        }
        return transactionContextHolder.getContext();
    }