org.hibernate.search.backend.impl
Class TransactionalWorker

java.lang.Object
  extended by org.hibernate.search.backend.impl.TransactionalWorker
All Implemented Interfaces:
Worker

public class TransactionalWorker
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
protected  WeakIdentityHashMap<Object,Synchronization> synchronizationPerTransaction
           
 
Constructor Summary
TransactionalWorker()
           
 
Method Summary
 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 WeakIdentityHashMap<Object,Synchronization> synchronizationPerTransaction
Constructor Detail

TransactionalWorker

public TransactionalWorker()
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-2012 Red Hat Middleware, LLC. All Rights Reserved