org.hibernate.search.batchindexing.impl

## Class OptionallyWrapInJTATransaction

- java.lang.Object
- - org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction

- All Implemented Interfaces:
    Runnable

      public class OptionallyWrapInJTATransaction
      extends Object

  Wraps the execution of a `Runnable` in a JTA Transaction if necessary:
  - if the existing Hibernate Core transaction strategy requires a TransactionManager
  - if no JTA transaction is already started
  Unfortunately at this time we need to have access to `SessionFactoryImplementor`.
  Author:
    Emmanuel Bernard

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ExtendedSearchIntegrator` | `extendedIntegrator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OptionallyWrapInJTATransaction(BatchTransactionalContext batchContext, StatelessSessionAwareRunnable statelessSessionAwareRunnable, Integer transactionTimeout, String tenantId)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `cleanUpOnError()`
    `void` | `run()`
    `void` | `runWithErrorHandler()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### extendedIntegrator

          protected final ExtendedSearchIntegrator extendedIntegrator

  - ### Constructor Detail

    - #### OptionallyWrapInJTATransaction

          public OptionallyWrapInJTATransaction(BatchTransactionalContext batchContext,
                                                StatelessSessionAwareRunnable statelessSessionAwareRunnable,
                                                Integer transactionTimeout,
                                                String tenantId)

  - ### Method Detail

    - #### runWithErrorHandler

          public void runWithErrorHandler()
                                   throws Exception

      Throws:
        `Exception`

    - #### cleanUpOnError

          protected void cleanUpOnError()

    - #### run

          public final void run()

      Specified by:
        `run` in interface `Runnable`

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved