Tabnine Logo
DefaultTransactionStatus.isDebug
Code IndexAdd Tabnine to your IDE (free)

How to use
isDebug
method
in
org.springframework.transaction.support.DefaultTransactionStatus

Best Java code snippets using org.springframework.transaction.support.DefaultTransactionStatus.isDebug (Showing top 20 results out of 315)

origin: spring-projects/spring-framework

/**
 * Trigger {@code beforeCompletion} callbacks.
 * @param status object representing the transaction
 */
protected final void triggerBeforeCompletion(DefaultTransactionStatus status) {
  if (status.isNewSynchronization()) {
    if (status.isDebug()) {
      logger.trace("Triggering beforeCompletion synchronization");
    }
    TransactionSynchronizationUtils.triggerBeforeCompletion();
  }
}
origin: spring-projects/spring-framework

/**
 * Trigger {@code afterCommit} callbacks.
 * @param status object representing the transaction
 */
private void triggerAfterCommit(DefaultTransactionStatus status) {
  if (status.isNewSynchronization()) {
    if (status.isDebug()) {
      logger.trace("Triggering afterCommit synchronization");
    }
    TransactionSynchronizationUtils.triggerAfterCommit();
  }
}
origin: spring-projects/spring-framework

/**
 * Trigger {@code beforeCommit} callbacks.
 * @param status object representing the transaction
 */
protected final void triggerBeforeCommit(DefaultTransactionStatus status) {
  if (status.isNewSynchronization()) {
    if (status.isDebug()) {
      logger.trace("Triggering beforeCommit synchronization");
    }
    TransactionSynchronizationUtils.triggerBeforeCommit(status.isReadOnly());
  }
}
origin: spring-projects/spring-framework

@Override
protected void doCommit(DefaultTransactionStatus status) {
  DataSourceTransactionObject txObject = (DataSourceTransactionObject) status.getTransaction();
  Connection con = txObject.getConnectionHolder().getConnection();
  if (status.isDebug()) {
    logger.debug("Committing JDBC transaction on Connection [" + con + "]");
  }
  try {
    con.commit();
  }
  catch (SQLException ex) {
    throw new TransactionSystemException("Could not commit JDBC transaction", ex);
  }
}
origin: spring-projects/spring-framework

@Override
protected void doRollback(DefaultTransactionStatus status) {
  DataSourceTransactionObject txObject = (DataSourceTransactionObject) status.getTransaction();
  Connection con = txObject.getConnectionHolder().getConnection();
  if (status.isDebug()) {
    logger.debug("Rolling back JDBC transaction on Connection [" + con + "]");
  }
  try {
    con.rollback();
  }
  catch (SQLException ex) {
    throw new TransactionSystemException("Could not roll back JDBC transaction", ex);
  }
}
origin: spring-projects/spring-framework

@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
  HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
  if (status.isDebug()) {
    logger.debug("Setting Hibernate transaction on Session [" +
        txObject.getSessionHolder().getSession() + "] rollback-only");
  }
  txObject.setRollbackOnly();
}
origin: spring-projects/spring-framework

@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
  JpaTransactionObject txObject = (JpaTransactionObject) status.getTransaction();
  if (status.isDebug()) {
    logger.debug("Setting JPA transaction on EntityManager [" +
        txObject.getEntityManagerHolder().getEntityManager() + "] rollback-only");
  }
  txObject.setRollbackOnly();
}
origin: spring-projects/spring-framework

@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
  DataSourceTransactionObject txObject = (DataSourceTransactionObject) status.getTransaction();
  if (status.isDebug()) {
    logger.debug("Setting JDBC transaction [" + txObject.getConnectionHolder().getConnection() +
        "] rollback-only");
  }
  txObject.setRollbackOnly();
}
origin: spring-projects/spring-framework

@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
  CciLocalTransactionObject txObject = (CciLocalTransactionObject) status.getTransaction();
  if (status.isDebug()) {
    logger.debug("Setting CCI local transaction [" + txObject.getConnectionHolder().getConnection() +
        "] rollback-only");
  }
  txObject.getConnectionHolder().setRollbackOnly();
}
origin: spring-projects/spring-framework

/**
 * Invoke {@code doRollback}, handling rollback exceptions properly.
 * @param status object representing the transaction
 * @param ex the thrown application exception or error
 * @throws TransactionException in case of rollback failure
 * @see #doRollback
 */
private void doRollbackOnCommitException(DefaultTransactionStatus status, Throwable ex) throws TransactionException {
  try {
    if (status.isNewTransaction()) {
      if (status.isDebug()) {
        logger.debug("Initiating transaction rollback after commit exception", ex);
      }
      doRollback(status);
    }
    else if (status.hasTransaction() && isGlobalRollbackOnParticipationFailure()) {
      if (status.isDebug()) {
        logger.debug("Marking existing transaction as rollback-only after commit exception", ex);
      }
      doSetRollbackOnly(status);
    }
  }
  catch (RuntimeException | Error rbex) {
    logger.error("Commit exception overridden by rollback exception", ex);
    triggerAfterCompletion(status, TransactionSynchronization.STATUS_UNKNOWN);
    throw rbex;
  }
  triggerAfterCompletion(status, TransactionSynchronization.STATUS_ROLLED_BACK);
}
origin: spring-projects/spring-framework

@Override
protected void doRollback(DefaultTransactionStatus status) {
  JmsTransactionObject txObject = (JmsTransactionObject) status.getTransaction();
  Session session = txObject.getResourceHolder().getSession();
  if (session != null) {
    try {
      if (status.isDebug()) {
        logger.debug("Rolling back JMS transaction on Session [" + session + "]");
      }
      session.rollback();
    }
    catch (JMSException ex) {
      throw new TransactionSystemException("Could not roll back JMS transaction", ex);
    }
  }
}
origin: spring-projects/spring-framework

@Override
protected void doRollback(DefaultTransactionStatus status) {
  JpaTransactionObject txObject = (JpaTransactionObject) status.getTransaction();
  if (status.isDebug()) {
    logger.debug("Rolling back JPA transaction on EntityManager [" +
        txObject.getEntityManagerHolder().getEntityManager() + "]");
  }
  try {
    EntityTransaction tx = txObject.getEntityManagerHolder().getEntityManager().getTransaction();
    if (tx.isActive()) {
      tx.rollback();
    }
  }
  catch (PersistenceException ex) {
    throw new TransactionSystemException("Could not roll back JPA transaction", ex);
  }
  finally {
    if (!txObject.isNewEntityManagerHolder()) {
      // Clear all pending inserts/updates/deletes in the EntityManager.
      // Necessary for pre-bound EntityManagers, to avoid inconsistent state.
      txObject.getEntityManagerHolder().getEntityManager().clear();
    }
  }
}
origin: spring-projects/spring-framework

@Override
protected void doCommit(DefaultTransactionStatus status) {
  JmsTransactionObject txObject = (JmsTransactionObject) status.getTransaction();
  Session session = txObject.getResourceHolder().getSession();
  if (session != null) {
    try {
      if (status.isDebug()) {
        logger.debug("Committing JMS transaction on Session [" + session + "]");
      }
      session.commit();
    }
    catch (TransactionRolledBackException ex) {
      throw new UnexpectedRollbackException("JMS transaction rolled back", ex);
    }
    catch (JMSException ex) {
      throw new TransactionSystemException("Could not commit JMS transaction", ex);
    }
  }
}
origin: spring-projects/spring-framework

@Override
protected void doRollback(DefaultTransactionStatus status) {
  CciLocalTransactionObject txObject = (CciLocalTransactionObject) status.getTransaction();
  Connection con = txObject.getConnectionHolder().getConnection();
  if (status.isDebug()) {
    logger.debug("Rolling back CCI local transaction on Connection [" + con + "]");
  }
  try {
    con.getLocalTransaction().rollback();
  }
  catch (LocalTransactionException ex) {
    throw new TransactionSystemException("Could not roll back CCI local transaction", ex);
  }
  catch (ResourceException ex) {
    throw new TransactionSystemException("Unexpected failure on rollback of CCI local transaction", ex);
  }
}
origin: spring-projects/spring-framework

@Override
protected void doCommit(DefaultTransactionStatus status) {
  CciLocalTransactionObject txObject = (CciLocalTransactionObject) status.getTransaction();
  Connection con = txObject.getConnectionHolder().getConnection();
  if (status.isDebug()) {
    logger.debug("Committing CCI local transaction on Connection [" + con + "]");
  }
  try {
    con.getLocalTransaction().commit();
  }
  catch (LocalTransactionException ex) {
    throw new TransactionSystemException("Could not commit CCI local transaction", ex);
  }
  catch (ResourceException ex) {
    throw new TransactionSystemException("Unexpected failure on commit of CCI local transaction", ex);
  }
}
origin: spring-projects/spring-framework

@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
  JtaTransactionObject txObject = (JtaTransactionObject) status.getTransaction();
  if (status.isDebug()) {
    logger.debug("Setting JTA transaction rollback-only");
  }
  try {
    int jtaStatus = txObject.getUserTransaction().getStatus();
    if (jtaStatus != Status.STATUS_NO_TRANSACTION && jtaStatus != Status.STATUS_ROLLEDBACK) {
      txObject.getUserTransaction().setRollbackOnly();
    }
  }
  catch (IllegalStateException ex) {
    throw new TransactionSystemException("Unexpected internal transaction state", ex);
  }
  catch (SystemException ex) {
    throw new TransactionSystemException("JTA failure on setRollbackOnly", ex);
  }
}
origin: spring-projects/spring-framework

/**
 * Trigger {@code afterCompletion} callbacks.
 * @param status object representing the transaction
 * @param completionStatus completion status according to TransactionSynchronization constants
 */
private void triggerAfterCompletion(DefaultTransactionStatus status, int completionStatus) {
  if (status.isNewSynchronization()) {
    List<TransactionSynchronization> synchronizations = TransactionSynchronizationManager.getSynchronizations();
    TransactionSynchronizationManager.clearSynchronization();
    if (!status.hasTransaction() || status.isNewTransaction()) {
      if (status.isDebug()) {
        logger.trace("Triggering afterCompletion synchronization");
      }
      // No transaction or new transaction for the current scope ->
      // invoke the afterCompletion callbacks immediately
      invokeAfterCompletion(synchronizations, completionStatus);
    }
    else if (!synchronizations.isEmpty()) {
      // Existing transaction that we participate in, controlled outside
      // of the scope of this Spring transaction manager -> try to register
      // an afterCompletion callback with the existing (JTA) transaction.
      registerAfterCompletionWithExistingTransaction(status.getTransaction(), synchronizations);
    }
  }
}
origin: spring-projects/spring-framework

@Override
protected void doCommit(DefaultTransactionStatus status) {
  HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
  Transaction hibTx = txObject.getSessionHolder().getTransaction();
  Assert.state(hibTx != null, "No Hibernate transaction");
  if (status.isDebug()) {
    logger.debug("Committing Hibernate transaction on Session [" +
        txObject.getSessionHolder().getSession() + "]");
  }
  try {
    hibTx.commit();
  }
  catch (org.hibernate.TransactionException ex) {
    // assumably from commit call to the underlying JDBC connection
    throw new TransactionSystemException("Could not commit Hibernate transaction", ex);
  }
  catch (HibernateException ex) {
    // assumably failed to flush changes to database
    throw convertHibernateAccessException(ex);
  }
  catch (PersistenceException ex) {
    if (ex.getCause() instanceof HibernateException) {
      throw convertHibernateAccessException((HibernateException) ex.getCause());
    }
    throw ex;
  }
}
origin: spring-projects/spring-framework

@Override
protected void doCommit(DefaultTransactionStatus status) {
  JpaTransactionObject txObject = (JpaTransactionObject) status.getTransaction();
  if (status.isDebug()) {
    logger.debug("Committing JPA transaction on EntityManager [" +
        txObject.getEntityManagerHolder().getEntityManager() + "]");
  }
  try {
    EntityTransaction tx = txObject.getEntityManagerHolder().getEntityManager().getTransaction();
    tx.commit();
  }
  catch (RollbackException ex) {
    if (ex.getCause() instanceof RuntimeException) {
      DataAccessException dae = getJpaDialect().translateExceptionIfPossible((RuntimeException) ex.getCause());
      if (dae != null) {
        throw dae;
      }
    }
    throw new TransactionSystemException("Could not commit JPA transaction", ex);
  }
  catch (RuntimeException ex) {
    // Assumably failed to flush changes to database.
    throw DataAccessUtils.translateIfNecessary(ex, getJpaDialect());
  }
}
origin: spring-projects/spring-framework

/**
 * Clean up after completion, clearing synchronization if necessary,
 * and invoking doCleanupAfterCompletion.
 * @param status object representing the transaction
 * @see #doCleanupAfterCompletion
 */
private void cleanupAfterCompletion(DefaultTransactionStatus status) {
  status.setCompleted();
  if (status.isNewSynchronization()) {
    TransactionSynchronizationManager.clear();
  }
  if (status.isNewTransaction()) {
    doCleanupAfterCompletion(status.getTransaction());
  }
  if (status.getSuspendedResources() != null) {
    if (status.isDebug()) {
      logger.debug("Resuming suspended transaction after completion of inner transaction");
    }
    Object transaction = (status.hasTransaction() ? status.getTransaction() : null);
    resume(transaction, (SuspendedResourcesHolder) status.getSuspendedResources());
  }
}
org.springframework.transaction.supportDefaultTransactionStatusisDebug

Javadoc

Return whether the progress of this transaction is debugged. This is used by AbstractPlatformTransactionManager as an optimization, to prevent repeated calls to logger.isDebugEnabled(). Not really intended for client code.

Popular methods of DefaultTransactionStatus

  • getTransaction
    Return the underlying transaction object.
  • <init>
    Create a new DefaultTransactionStatus instance.
  • isNewTransaction
  • isReadOnly
    Return if this transaction is defined as read-only transaction.
  • getSuspendedResources
    Return the holder for resources that have been suspended for this transaction, if any.
  • isNewSynchronization
    Return if a new transaction synchronization has been opened for this transaction.
  • hasTransaction
    Return whether there is an actual transaction active.
  • isGlobalRollbackOnly
    Determine the rollback-only flag via checking the transaction object, provided that the latter imple
  • setRollbackOnly
  • createAndHoldSavepoint
  • hasSavepoint
  • isLocalRollbackOnly
  • hasSavepoint,
  • isLocalRollbackOnly,
  • releaseHeldSavepoint,
  • rollbackToHeldSavepoint,
  • setCompleted,
  • isCompleted,
  • isTransactionSavepointManager

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • compareTo (BigDecimal)
  • getApplicationContext (Context)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • JList (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now