Package proj.zoie.api

Examples of proj.zoie.api.ZoieException


   * @param version the version of events which it waits for.
   * @throws ZoieException
   */
  public void syncWthVersion(long timeInMillis, V version) throws ZoieException
  {
    if(_consumerThread == null) throw new ZoieException("not running");
    if (version == null)
    {
      log.info("buffered version is NULL. Nothing to flush.");
      return;
    }
    synchronized(this)
    {
      long timeRemaining = Long.MAX_VALUE;
      while(_currentVersion==null || _currentVersion.compareTo(version) < 0)
      {
        if (log.isDebugEnabled())
        {
          if (timeRemaining > timeInMillis + 5000)
          log.debug("syncWithVersion: timeRemaining: " +timeInMillis+"ms current: " + _currentVersion + " expecting: " + version);
          timeRemaining = timeInMillis;
        }
        this.notifyAll();
        long now1 = System.currentTimeMillis();
        if(timeInMillis<=0)
        {
          throw new ZoieException("sync timed out at current: " + _currentVersion + " expecting: " + version);
        }
        try
        {
          long waitTime = Math.min(5000, timeInMillis);
          this.wait(waitTime);
View Full Code Here


      while(_batch.size() >= _batchSize)
      {
        if(_consumerThread == null || !_consumerThread.isAlive() || _consumerThread._stop)
        {
          ZoieHealth.setFatal();
          throw new ZoieException("consumer thread has stopped");
        }
        try
        {
          this.notifyAll();
          this.wait();
View Full Code Here

        cachemonitor.notifyAll();
        long elapsed = System.currentTimeMillis() - begintime;
        if (elapsed > timeout)
        {
          log.debug("refreshCached reader timeout in " + elapsed + "ms");
          throw new ZoieException("refreshCached reader timeout in " + elapsed + "ms");
        }
        long timetowait = Math.min(timeout - elapsed, 200);
        try
        {
          cachemonitor.wait(timetowait);
View Full Code Here

      }
      catch(IOException ioe)
      {
        ZoieHealth.setFatal();
        log.error("Problem copying segments: " + ioe.getMessage(), ioe);
        throw new ZoieException(ioe);
      }
    }
View Full Code Here

              expungeDeletes();
            }
            catch(IOException ioe)
            {
              ZoieHealth.setFatal();
              throw new ZoieException(ioe.getMessage(),ioe);
            }
            finally
            {
              _optScheduler.finished();
            }
View Full Code Here

              expungeDeletes();
            }
            catch(IOException ioe)
            {
              ZoieHealth.setFatal();
              throw new ZoieException(ioe.getMessage(),ioe);
            }
            finally
            {
              _optScheduler.finished();
            }
View Full Code Here

        {
          while (_currentVersion == null || _currentVersion.compareTo(version) < 0)
          {
            if (now >= due)
            {
              throw new ZoieException("sync timed out");
            }
            try
            {
              this.notifyAll();
              _flushing = true;
View Full Code Here

  }
 
  public void consume(Collection<proj.zoie.api.DataConsumer.DataEvent<D,V>> events)
      throws ZoieException {
    if (_writer == null){
      throw new ZoieException("Internal IndexWriter null, perhaps not started?");
    }
   
    if (events.size() > 0){
      for (DataEvent<D,V> event : events){
        ZoieIndexable indexable = _interpreter.convertAndInterpret(event.getData());
        if (indexable.isSkip()) continue;
       
        try {
          _writer.deleteDocuments(new Term(DOCUMENT_ID_FIELD,String.valueOf(indexable.getUID())));
        } catch(IOException e) {
          throw new ZoieException(e.getMessage(),e);
        }
         
        IndexingReq[] reqs = indexable.buildIndexingReqs();
        for (IndexingReq req : reqs){
        Analyzer localAnalyzer = req.getAnalyzer();
        Document doc = req.getDocument();
        Field uidField = new Field(DOCUMENT_ID_FIELD,String.valueOf(indexable.getUID()),Store.NO,Index.NOT_ANALYZED_NO_NORMS);
        uidField.setOmitTermFreqAndPositions(true);
        doc.add(uidField);
        if (localAnalyzer == null) localAnalyzer = _analyzer;
        try {
          _writer.addDocument(doc, localAnalyzer);
        } catch(IOException e) {
          throw new ZoieException(e.getMessage(),e);
        }
        }
      }
     
     
      int numdocs;
      try {
        // for realtime commit is not needed per lucene mailing list
        //_writer.commit();
        numdocs = _writer.numDocs();
      } catch (IOException e) {
        throw new ZoieException(e.getMessage(),e);
      }
     
      logger.info("flushed "+events.size()+" events to index, index now contains "+numdocs+" docs.");
    }
  }
View Full Code Here

        cachemonitor.notifyAll();
        long elapsed = System.currentTimeMillis() - begintime;
        if (elapsed > timeout)
        {
          log.debug("refreshCached reader timeout in " + elapsed + "ms");
          throw new ZoieException("refreshCached reader timeout in " + elapsed + "ms");
        }
        long timetowait = Math.min(timeout - elapsed, 200);
        try
        {
          cachemonitor.wait(timetowait);
View Full Code Here

  }
 
  public void consume(Collection<proj.zoie.api.DataConsumer.DataEvent<D,V>> events)
      throws ZoieException {
    if (_writer == null){
      throw new ZoieException("Internal IndexWriter null, perhaps not started?");
    }
   
    if (events.size() > 0){
      for (DataEvent<D,V> event : events){
        ZoieIndexable indexable = _interpreter.convertAndInterpret(event.getData());
        if (indexable.isSkip()) continue;
       
        try {
          _writer.deleteDocuments(new Term(DOCUMENT_ID_FIELD,String.valueOf(indexable.getUID())));
        } catch(IOException e) {
          throw new ZoieException(e.getMessage(),e);
        }
         
        IndexingReq[] reqs = indexable.buildIndexingReqs();
        for (IndexingReq req : reqs){
        Analyzer localAnalyzer = req.getAnalyzer();
        Document doc = req.getDocument();
        Field uidField = new Field(DOCUMENT_ID_FIELD,String.valueOf(indexable.getUID()),Store.NO,Index.NOT_ANALYZED_NO_NORMS);
        uidField.setOmitTermFreqAndPositions(true);
        doc.add(uidField);
        if (localAnalyzer == null) localAnalyzer = _analyzer;
        try {
          _writer.addDocument(doc, localAnalyzer);
        } catch(IOException e) {
          throw new ZoieException(e.getMessage(),e);
        }
        }
      }
     
     
      int numdocs;
      try {
        // for realtime commit is not needed per lucene mailing list
        //_writer.commit();
        numdocs = _writer.numDocs();
      } catch (IOException e) {
        throw new ZoieException(e.getMessage(),e);
      }
     
      logger.info("flushed "+events.size()+" events to index, index now contains "+numdocs+" docs.");
    }
  }
View Full Code Here

TOP

Related Classes of proj.zoie.api.ZoieException

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.