Ejemplo n.º 1
0
  @Override
  public void consume(Collection<DataEvent<ZoieIndexable<VALUE>, V>> events) throws ZoieException {
    // updates the in memory status before and after the work
    synchronized (_optimizeMonitor) {
      try {
        _idxMgr.setDiskIndexerStatus(Status.Working);
        OptimizeType optType = _optScheduler.getScheduledOptimizeType();
        _idxMgr.setPartialExpunge(optType == OptimizeType.PARTIAL);
        try {
          System.out.println("DiskLuceneIndexDataLoader:consume(): disk consume");
          super.consume(events);
        } finally {
          _optScheduler.finished();
          _idxMgr.setPartialExpunge(false);
        }

        if (optType == OptimizeType.FULL) {
          try {
            expungeDeletes();
          } catch (IOException ioe) {
            ZoieHealth.setFatal();
            throw new ZoieException(ioe.getMessage(), ioe);
          } finally {
            _optScheduler.finished();
          }
        }
      } finally {
        _idxMgr.setDiskIndexerStatus(Status.Sleep);
      }
    }
  }
Ejemplo n.º 2
0
  @Override
  public void loadFromIndex(RAMSearchIndex<R, V> ramIndex) throws ZoieException {

    synchronized (_optimizeMonitor) {
      try {
        _idxMgr.setDiskIndexerStatus(Status.Working);

        OptimizeType optType = _optScheduler.getScheduledOptimizeType();
        _idxMgr.setPartialExpunge(optType == OptimizeType.PARTIAL);
        try {
          super.loadFromIndex(ramIndex);
        } finally {
          _optScheduler.finished();
          _idxMgr.setPartialExpunge(false);
        }

        if (optType == OptimizeType.FULL) {
          try {
            expungeDeletes();
          } catch (IOException ioe) {
            ZoieHealth.setFatal();
            throw new ZoieException(ioe.getMessage(), ioe);
          } finally {
            _optScheduler.finished();
          }
        }
      } finally {
        _idxMgr.setDiskIndexerStatus(Status.Sleep);
      }
    }
  }