Package org.hibernate.search.backend

Examples of org.hibernate.search.backend.WorkQueue


    if ( event.getSession().isTransactionInProgress() ) {
      Transaction transaction = event.getSession().getTransaction();
      PostTransactionWorkQueueSynchronization sync = (PostTransactionWorkQueueSynchronization)
          queuePerTransaction.get( transaction );
      if ( sync == null || sync.isConsumed() ) {
        WorkQueue workQueue = new BatchLuceneWorkQueue( documentBuilders, lockableDirectoryProviders );
        sync = new PostTransactionWorkQueueSynchronization( workQueue, queuePerTransaction );
        transaction.registerSynchronization( sync );
        queuePerTransaction.put(transaction, sync);
      }
      sync.add( work );
    }
    else {
      WorkQueue workQueue = new BatchLuceneWorkQueue( documentBuilders, lockableDirectoryProviders );
      PostTransactionWorkQueueSynchronization sync = new PostTransactionWorkQueueSynchronization( workQueue );
      sync.add( work );
      sync.afterCompletion( Status.STATUS_COMMITTED );
    }
  }
View Full Code Here


  }

  private PostTransactionWorkQueueSynchronization createWorkQueueSync(
      Map<Class, DocumentBuilder<Object>> documentBuilders,
      Map<DirectoryProvider, ReentrantLock> lockableDirectoryProviders) {
    WorkQueue workQueue = new BatchLuceneWorkQueue( documentBuilders, lockableDirectoryProviders );
    return new PostTransactionWorkQueueSynchronization( workQueue );
  }
View Full Code Here

   */
  public PostTransactionWorkQueueSynchronization(QueueingProcessor queueingProcessor, WeakIdentityHashMap queuePerTransaction,
      SearchFactoryImplementor searchFactoryImplementor) {
    this.queueingProcessor = queueingProcessor;
    this.queuePerTransaction = queuePerTransaction;
    queue = new WorkQueue( searchFactoryImplementor );
  }
View Full Code Here

      }
    }
  }

  public void flushWorks() {
    WorkQueue subQueue = queue.splitQueue();
    queueingProcessor.prepareWorks( subQueue );
    queueingProcessor.performWorks( subQueue );
  }
View Full Code Here

  public void add(Work work, WorkQueue workQueue) {
    //don't check for builder it's done in prepareWork
    //FIXME WorkType.COLLECTION does not play well with batchSize
    workQueue.add( work );
    if ( batchSize > 0 && workQueue.size() >= batchSize ) {
      WorkQueue subQueue = workQueue.splitQueue();
      prepareWorks( subQueue );
      performWorks( subQueue );
    }
  }
View Full Code Here

      // for correct configurations.
      log.warn(
          "It appears changes are being pushed to the index out of a transaction. " +
              "Register the IndexWorkFlushEventListener listener on flush to correctly manage Collections!"
      );
      WorkQueue queue = new WorkQueue( factory );
      queueingProcessor.add( work, queue );
      queueingProcessor.prepareWorks( queue );
      queueingProcessor.performWorks( queue );
    }
  }
View Full Code Here

      if (queuePerTransaction != null) queuePerTransaction.removeValue( this );
    }
  }

  public void flushWorks() {
    WorkQueue subQueue = queue.splitQueue();
    queueingProcessor.prepareWorks( subQueue );
    queueingProcessor.performWorks( subQueue );
  }
View Full Code Here

        synchronizationPerTransaction.put( transaction, txSync );
      }
      txSync.add( work );
    }
    else {
      WorkQueue queue = new WorkQueue( 2 ); //one work can be split
      queueingProcessor.add( work, queue );
      queueingProcessor.prepareWorks( queue );
      queueingProcessor.performWorks( queue );
    }
  }
View Full Code Here

      if (queuePerTransaction != null) queuePerTransaction.removeValue( this );
    }
  }

  public void flushWorks() {
    WorkQueue subQueue = queue.splitQueue();
    queueingProcessor.prepareWorks( subQueue );
    queueingProcessor.performWorks( subQueue );
  }
View Full Code Here

  public void add(Work work, WorkQueue workQueue) {
    //don't check for builder it's done in prepareWork
    //FIXME WorkType.COLLECTION does not play well with batchSize
    workQueue.add( work );
    if ( batchSize > 0 && workQueue.size() >= batchSize ) {
      WorkQueue subQueue = workQueue.splitQueue();
      prepareWorks( subQueue );
      performWorks( subQueue );
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.backend.WorkQueue

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.