Package org.hibernate.search.exception

Examples of org.hibernate.search.exception.ErrorHandler


    return new EntityKeyMetadata( persister.getTableName(), persister.getRootTableIdentifierColumnNames() );
  }

  @Override
  public void run() {
    ErrorHandler errorHandler = searchFactory.getErrorHandler();
    try {
      final EntityKeyMetadata keyMetadata = getEntityKeyMetadata();
      final SessionAwareRunnable consumer = new TupleIndexer( indexedType, monitor, sessionFactory, searchFactory, cacheMode, batchBackend, errorHandler );
      gridDialect.forEachTuple( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, consumer ), keyMetadata );
    }
    catch ( RuntimeException re ) {
      // being this an async thread we want to make sure everything is somehow reported
      errorHandler.handleException( log.massIndexerUnexpectedErrorMessage(), re );
    }
    finally {
      endAllSignal.countDown();
    }
  }
View Full Code Here


    this.monitor = monitor;
    this.objectsLimit = objectsLimit;
  }

  public void run() {
    ErrorHandler errorHandler = searchFactory.getErrorHandler();
    try {

      //first start the consumers, then the producers (reverse order):
      for ( int i = 0; i < luceneWorkerBuildingThreadNum; i++ ) {
        //from entity to LuceneWork:
        final EntityConsumerLuceneWorkProducer producer = new EntityConsumerLuceneWorkProducer(
            fromEntityToAddwork, monitor,
            sessionFactory, producerEndSignal, searchFactory,
            cacheMode, backend, errorHandler
        );
        execDocBuilding.execute( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, producer ) );
      }
      for ( int i = 0; i < objectLoadingThreadNum; i++ ) {
        //from primary key to loaded entity:
        final IdentifierConsumerEntityProducer producer = new IdentifierConsumerEntityProducer(
            fromIdentifierListToEntities, fromEntityToAddwork, monitor,
            sessionFactory, cacheMode, indexedType, idNameOfIndexedType, errorHandler
        );
        execFirstLoader.execute( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, producer ) );
      }
      //from class definition to all primary keys:
      final IdentifierProducer producer = new IdentifierProducer(
          fromIdentifierListToEntities, sessionFactory,
          objectLoadingBatchSize, indexedType, monitor,
          objectsLimit, errorHandler, idFetchSize
      );
      execIdentifiersLoader.execute( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, producer ) );

      //shutdown all executors:
      execIdentifiersLoader.shutdown();
      execFirstLoader.shutdown();
      execDocBuilding.shutdown();
      try {
        producerEndSignal.await(); //await for all work being sent to the backend
        log.debugf( "All work for type %s has been produced", indexedType.getName() );
      }
      catch ( InterruptedException e ) {
        //restore interruption signal:
        Thread.currentThread().interrupt();
        throw new SearchException( "Interrupted on batch Indexing; index will be left in unknown state!", e );
      }
    }
    catch ( RuntimeException re ) {
      //being this an async thread we want to make sure everything is somehow reported
      errorHandler.handleException( log.massIndexerUnexpectedErrorMessage() , re );
    }
    finally {
      endAllSignal.countDown();
    }
  }
View Full Code Here

    this.monitor = monitor;
    this.objectsLimit = objectsLimit;
  }

  public void run() {
    ErrorHandler errorHandler = searchFactory.getErrorHandler();
    try {

      //first start the consumers, then the producers (reverse order):
      for ( int i = 0; i < luceneWorkerBuildingThreadNum; i++ ) {
        //from entity to LuceneWork:
        final EntityConsumerLuceneWorkProducer producer = new EntityConsumerLuceneWorkProducer(
            fromEntityToAddwork, monitor,
            sessionFactory, producerEndSignal, searchFactory,
            cacheMode, backend, errorHandler
        );
        execDocBuilding.execute( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, producer ) );
      }
      for ( int i = 0; i < objectLoadingThreadNum; i++ ) {
        //from primary key to loaded entity:
        final IdentifierConsumerEntityProducer producer = new IdentifierConsumerEntityProducer(
            fromIdentifierListToEntities, fromEntityToAddwork, monitor,
            sessionFactory, cacheMode, indexedType, idNameOfIndexedType, errorHandler
        );
        execFirstLoader.execute( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, producer ) );
      }
      //from class definition to all primary keys:
      final IdentifierProducer producer = new IdentifierProducer(
          fromIdentifierListToEntities, sessionFactory,
          objectLoadingBatchSize, indexedType, monitor,
          objectsLimit, errorHandler, idFetchSize
      );
      execIdentifiersLoader.execute( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, producer ) );

      //shutdown all executors:
      execIdentifiersLoader.shutdown();
      execFirstLoader.shutdown();
      execDocBuilding.shutdown();
      try {
        producerEndSignal.await(); //await for all work being sent to the backend
        log.debugf( "All work for type %s has been produced", indexedType.getName() );
      }
      catch ( InterruptedException e ) {
        //restore interruption signal:
        Thread.currentThread().interrupt();
        throw new SearchException( "Interrupted on batch Indexing; index will be left in unknown state!", e );
      }
    }
    catch ( RuntimeException re ) {
      //being this an async thread we want to make sure everything is somehow reported
      errorHandler.handleException( log.massIndexerUnexpectedErrorMessage() , re );
    }
    finally {
      endAllSignal.countDown();
    }
  }
View Full Code Here

    this.monitor = monitor;
    this.objectsLimit = objectsLimit;
  }

  public void run() {
    ErrorHandler errorHandler = searchFactory.getErrorHandler();
    try {

      //first start the consumers, then the producers (reverse order):
      for ( int i = 0; i < luceneWorkerBuildingThreadNum; i++ ) {
        //from entity to LuceneWork:
        final EntityConsumerLuceneWorkProducer producer = new EntityConsumerLuceneWorkProducer(
            fromEntityToAddwork, monitor,
            sessionFactory, producerEndSignal, searchFactory,
            cacheMode, backend, errorHandler
        );
        execDocBuilding.execute( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, producer ) );
      }
      for ( int i = 0; i < objectLoadingThreadNum; i++ ) {
        //from primary key to loaded entity:
        final IdentifierConsumerEntityProducer producer = new IdentifierConsumerEntityProducer(
            fromIdentifierListToEntities, fromEntityToAddwork, monitor,
            sessionFactory, cacheMode, indexedType, idNameOfIndexedType, errorHandler
        );
        execFirstLoader.execute( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, producer ) );
      }
      //from class definition to all primary keys:
      final IdentifierProducer producer = new IdentifierProducer(
          fromIdentifierListToEntities, sessionFactory,
          objectLoadingBatchSize, indexedType, monitor,
          objectsLimit, errorHandler, idFetchSize
      );
      execIdentifiersLoader.execute( new OptionallyWrapInJTATransaction( sessionFactory, errorHandler, producer ) );

      //shutdown all executors:
      execIdentifiersLoader.shutdown();
      execFirstLoader.shutdown();
      execDocBuilding.shutdown();
      try {
        producerEndSignal.await(); //await for all work being sent to the backend
        log.debugf( "All work for type %s has been produced", indexedType.getName() );
      }
      catch (InterruptedException e) {
        //restore interruption signal:
        Thread.currentThread().interrupt();
        throw new SearchException( "Interrupted on batch Indexing; index will be left in unknown state!", e );
      }
    }
    catch (RuntimeException re) {
      //being this an async thread we want to make sure everything is somehow reported
      errorHandler.handleException( log.massIndexerUnexpectedErrorMessage() , re );
    }
    finally {
      endAllSignal.countDown();
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.exception.ErrorHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.