Examples of WorkQueue


Examples of org.hibernate.search.backend.WorkQueue

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

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

Examples of org.hibernate.search.backend.WorkQueue

  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

Examples of org.hibernate.search.backend.WorkQueue

    else {
      // this is a workaround: isTransactionInProgress should return "true"
      // 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( 2 ); //one work can be split
      queueingProcessor.add( work, queue );
      queueingProcessor.prepareWorks( queue );
      queueingProcessor.performWorks( queue );
    }
  }
View Full Code Here

Examples of org.hibernate.search.backend.impl.WorkQueue

    emailAddress.setAddress( "foo@foobar.com" );
    emailAddress.setDefaultAddress( true );

    person.addEmailAddress( emailAddress );

    WorkQueue plannerEngine = new WorkQueue( searchFactory );

    plannerEngine.add( new Work( person, 1, WorkType.ADD ) );

    plannerEngine.prepareWorkPlan();
    List<LuceneWork> sealedQueue = plannerEngine.getSealedQueue();

    assertEquals( "There should only be one job in the queue", 1, sealedQueue.size() );
    assertTrue( "Wrong job type", sealedQueue.get( 0 ) instanceof AddLuceneWork );

    plannerEngine.add( new Work( person, 1, WorkType.DELETE ) );
    plannerEngine.prepareWorkPlan();
    sealedQueue = plannerEngine.getSealedQueue();

    assertEquals( "Jobs should have countered each other", 0, sealedQueue.size() );

    fullTextSession.close();
  }
View Full Code Here

Examples of org.nasutekds.server.api.WorkQueue

   * some circumstance.
   */
  private static void waitForOpsToComplete()
  {
    try {
      WorkQueue workQueue = DirectoryServer.getWorkQueue();
      final long NO_TIMEOUT = -1;
      workQueue.waitUntilIdle(NO_TIMEOUT);
    } catch (Exception e) {
      // Ignore it, maybe the server hasn't been started.
    }
  }
View Full Code Here

Examples of org.nasutekds.server.api.WorkQueue

         propertyDefinition.loadClass(workQueueConfig.getJavaClass(),
                                      WorkQueue.class);

    try
    {
      WorkQueue workQueue = workQueueClass.newInstance();

      Method method = workQueue.getClass().getMethod("initializeWorkQueue",
          workQueueConfig.configurationClass());
      method.invoke(workQueue, workQueueConfig);

      return workQueue;
    }
View Full Code Here

Examples of org.nasutekds.server.api.WorkQueue

    ArrayList<Message> messages            = new ArrayList<Message>();


    // If the work queue class has been changed, then we should warn the user
    // that it won't take effect until the server is restarted.
    WorkQueue workQueue = DirectoryServer.getWorkQueue();
    String workQueueClass = configuration.getJavaClass();
    if (! workQueueClass.equals(workQueue.getClass().getName()))
    {

      messages.add(INFO_CONFIG_WORK_QUEUE_CLASS_CHANGE_REQUIRES_RESTART.get(
              workQueue.getClass().getName(),
              workQueueClass));

      adminActionRequired = true;
    }
View Full Code Here

Examples of org.nasutekds.server.api.WorkQueue

   * Directory Server.
   */
  @Test()
  public void testWorkQueueEnabled()
  {
    WorkQueue workQueue = DirectoryServer.getWorkQueue();
    assertNotNull(workQueue);
    assertTrue(workQueue instanceof TraditionalWorkQueue);
  }
View Full Code Here

Examples of org.sonar.core.cluster.WorkQueue

public class BatchSessionTest {
  @Test
  public void shouldCommitWhenReachingBatchSize() {
    SqlSession mybatisSession = mock(SqlSession.class);
    WorkQueue queue = mock(WorkQueue.class);
    BatchSession session = new BatchSession(queue, mybatisSession, 10);

    for (int i = 0; i < 9; i++) {
      session.insert("id" + i);
      verify(mybatisSession).insert("id" + i);
View Full Code Here

Examples of org.sonar.core.cluster.WorkQueue

  }

  @Test
  public void shouldCommitWhenReachingBatchSizeWithoutCommits() {
    SqlSession mybatisSession = mock(SqlSession.class);
    WorkQueue queue = mock(WorkQueue.class);
    BatchSession session = new BatchSession(queue, mybatisSession, 10);

    ClusterAction action = new ClusterAction() {
      @Override
      public Object call() throws Exception {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.