Package org.openstreetmap.osmosis.plugin.elasticsearch.utils

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.utils.EntityBuffer


  }

  @Override
  public void run() {
    Entity entity = null;
    EntityBuffer entityBuffer = null;
    NewTypeNotification notification = null;
    while (running || !taskQueue.isEmpty()) {
      try {
        // Check if a NewTypeNotification was triggered
        if ((notification = newTypeNotification.getAndSet(null)) != null) {
          LOG.fine("NewTypeNotification detected, flushing...");
          if (entityBuffer != null) entityBuffer.flush();
          entityBuffer = bufferFactory.buildForType(notification.getType());
          notification.getLatch().countDown();
        }
        // Poll the queue
        if ((entity = taskQueue.poll(WorkerPool.POLL_INTERVAL, TimeUnit.MILLISECONDS)) != null) {
          entityBuffer.add(entity);
        }
      } catch (InterruptedException e) {
        LOG.fine("InterruptedException triggered, leaving...");
      }
    }
    if (entityBuffer != null) entityBuffer.flush();
    LOG.fine(String.format("%s shutdown", getName()));
  }
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.plugin.elasticsearch.utils.EntityBuffer

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.