Codota Logo
Transaction.rollback
Code IndexAdd Codota to your IDE (free)

How to use
rollback
method
in
org.ldp4j.application.kernel.transaction.Transaction

Best Java code snippets using org.ldp4j.application.kernel.transaction.Transaction.rollback (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: ldp4j/ldp4j

public void endTransaction(Transaction transaction) {
  if(transaction.isActive()) {
    transaction.rollback();
  }
  LOGGER.
    info("Completed transaction {}.{},",
      Thread.currentThread().getName(),
      transaction);
}
origin: ldp4j/ldp4j

/**
 * {@inheritDoc}
 */
@Override
public void close() throws SessionTerminationException {
  try {
    this.delegate.close();
  } finally {
    if(this.transaction.isActive()) {
      this.transaction.rollback();
    }
  }
}
origin: ldp4j/ldp4j

void rollbackSession(final DelegatedWriteSession session) {
  logLifecycleMessage("Rolling back session...");
  UnitOfWork.getCurrent().accept(new RollbackResourceProcessor());
  this.transactionManager.currentTransaction().rollback();
}
origin: ldp4j/ldp4j

public <T> T transactional(Callable<T> callable) throws Exception {
  Transaction transaction = RuntimeDelegate.getInstance().getTransactionManager().currentTransaction();
  transaction.begin();
  try {
    return callable.call();
  } catch(Exception e) {
    e.printStackTrace();
    throw e;
  } finally {
    try {
      assertThat(transaction.isActive(),equalTo(false));
    } catch (Exception e) {
      e.printStackTrace();
      transaction.rollback();
    }
  }
}
origin: ldp4j/ldp4j

protected final void withinTransaction(Task<T> task) throws Exception{
  Transaction tx = txManager.currentTransaction();
  tx.begin();
  boolean failed=false;
  try {
    this.logger.info(">> Started '{}'...",task.title);
    task.execute(this.sut);
    tx.commit();
    this.logger.info(">> Completed '{}'.",task.title);
  } catch(Exception e) {
    this.logger.info(">> Failed '{}': {}.",task.title,e.getMessage());
    failed=true;
    throw e;
  } finally {
    if(failed) {
      this.logger.debug("Transaction failed [active: {}]",tx.isActive());
    }
    if(tx.isActive()) {
      this.logger.info("Attempting rollback...");
      try {
        tx.rollback();
      } catch (Exception e) {
        this.logger.error("Rollback failed",e);
      }
    }
  }
}
origin: ldp4j/ldp4j

private void initialize(Application<T> application) throws ApplicationConfigurationException {
  Transaction transaction=this.transactionManager.currentTransaction();
  transaction.begin();
  try {
    WriteSession session =
      writeSessionService().
        createSession(
          WriteSessionConfiguration.
            builder().
              build());
    Throwable failure=null;
    try {
      application.initialize(session);
    } catch (ApplicationInitializationException e) {
      failure=e;
    } finally {
      failure=closeQuietly(session, failure);
    }
    if(failure!=null) {
      throw new ApplicationConfigurationException(failure);
    }
  } finally {
    if(transaction.isActive()) {
      transaction.rollback();
    }
  }
}
origin: ldp4j/ldp4j

private Resource initialize(final String id, final String path) {
  final Transaction transaction=
    RuntimeDelegate.
      getInstance().
        getTransactionManager().
          currentTransaction();
  transaction.begin();
  try {
    this.uow = UnitOfWork.newCurrent();
    final Resource resource=
      this.modelFactory.createResource(
        this.templateManagementService.templateOfId("personTemplate"),
        name(id));
    final Endpoint endpoint=this.modelFactory.createEndpoint(path,resource,new Date(),EntityTag.createStrong(path));
    RuntimeDelegate.getInstance().getResourceRepository().add(resource);
    RuntimeDelegate.getInstance().getEndpointRepository().add(endpoint);
    UnitOfWork.setCurrent(null);
    transaction.commit();
    return resource;
  } finally {
    if(transaction.isActive()) {
      transaction.rollback();
    }
  }
}
org.ldp4j.application.kernel.transactionTransactionrollback

Javadoc

Complete the transaction by discarding the changes

Popular methods of Transaction

  • begin
    Start the transaction
  • commit
    Complete the transaction by commiting the changes
  • isActive
    Check whether the transaction is active, that is, started and not completed.

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • requestLocationUpdates (LocationManager)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JPanel (javax.swing)
  • JTextField (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now