org.hibernate.search.backend.impl

## Class PerTransactionWorker

- java.lang.Object
- - org.hibernate.search.backend.impl.PerTransactionWorker

- All Implemented Interfaces:
    Worker

      public class PerTransactionWorker
      extends Object
      implements Worker

  Queue works per transaction. If out of transaction, the work is executed right away

  When `hibernate.search.worker.type` is set to `async` the work is done in a separate thread (threads are pooled)

  Author:
    Emmanuel Bernard

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ConcurrentMap<Object,WorkQueueSynchronization>` | `synchronizationPerTransaction`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PerTransactionWorker()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` clean resources This method can return exceptions
    `void` | `flushWorks(TransactionContext transactionContext)` Flush any work queue.
    `void` | `initialize(Properties props, WorkerBuildContext context, QueueingProcessor queueingProcessor)`
    `void` | `performWork(Work work, TransactionContext transactionContext)` Declare a work to be done within a given transaction context

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

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

- - ### Field Detail

    - #### synchronizationPerTransaction

          protected final ConcurrentMap<Object,WorkQueueSynchronization> synchronizationPerTransaction

  - ### Constructor Detail

    - #### PerTransactionWorker

          public PerTransactionWorker()

  - ### Method Detail

    - #### performWork

          public void performWork(Work work,
                                  TransactionContext transactionContext)

      Description copied from interface: `Worker`
      Declare a work to be done within a given transaction context
      Specified by:
        `performWork` in interface `Worker`
      Parameters:
        `work` - the work to be executed
        `transactionContext` - transactional context information

    - #### initialize

          public void initialize(Properties props,
                                 WorkerBuildContext context,
                                 QueueingProcessor queueingProcessor)

      Specified by:
        `initialize` in interface `Worker`

    - #### close

          public void close()

      Description copied from interface: `Worker`
      clean resources This method can return exceptions
      Specified by:
        `close` in interface `Worker`

    - #### flushWorks

          public void flushWorks(TransactionContext transactionContext)

      Description copied from interface: `Worker`
      Flush any work queue.
      Specified by:
        `flushWorks` in interface `Worker`
      Parameters:
        `transactionContext` - the current transaction (context).

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