Examples of ZoieException


Examples of proj.zoie.api.ZoieException

      return result;
    }
    catch(Exception e)
    {
      log.error(e.getMessage(),e);
      throw new ZoieException(e.getMessage(),e);
    }
    finally
    {
      try{
        if (searcher!=null)
View Full Code Here

Examples of proj.zoie.api.ZoieException

    }
    catch(Exception e)
    {
      for(QueryRunnable queryThread : queryRunnables)
      {
        if(queryThread.exception == null) throw new ZoieException(e);
      }
    }
    finally
    {
      memoryProvider.stop();
      for(String bname : idxSystem.getStandardMBeanNames())
      {
        unregisterMBean(bname);
      }
      idxSystem.shutdown();
      deleteDirectory(idxDir);
    }
    System.out.println(" done round");
    log.info(" done round");
    for(QueryRunnable queryThread : queryRunnables)
    {
      if(queryThread.exception != null) throw new ZoieException(queryThread.exception);
    }
  }
View Full Code Here

Examples of proj.zoie.api.ZoieException

    }
    catch(Exception e)
    {
      for(QueryThread queryThread : queryThreads)
      {
        if(queryThread.exception == null) throw new ZoieException(e);
      }
    }
    finally
    {
      memoryProvider.stop();
      for(String bname : idxSystem.getStandardMBeanNames())
      {
        unregisterMBean(bname);
      }
      idxSystem.shutdown();
      deleteDirectory(idxDir);
    }
    System.out.println(" done round");
    log.info(" done round");
    for(QueryThread queryThread : queryThreads)
    {
      if(queryThread.exception != null) throw new ZoieException(queryThread.exception);
    }
  }
View Full Code Here

Examples of proj.zoie.api.ZoieException

      idxSystem.returnIndexReaders(readers);
     
      assertEquals(count, numDocs);
    }
    catch(IOException ioe){
        throw new ZoieException(ioe.getMessage());
      }
      finally
      {
        memoryProvider.stop();
        idxSystem.shutdown();
View Full Code Here

Examples of proj.zoie.api.ZoieException

    Query q=null;
    try
    {
      q=parser.parse(query);
    } catch (ParseException e) {
      throw new ZoieException(e.getMessage(),e);
    }
    MemoryStreamDataProvider<String, DefaultZoieVersion> memoryProvider=new MemoryStreamDataProvider<String, DefaultZoieVersion>();
    memoryProvider.setMaxEventsPerMinute(Long.MAX_VALUE);
    memoryProvider.setDataConsumer(idxSystem);
    memoryProvider.start();
    try
    {
      int count=TestData.testdata.length;
      List<DataEvent<String,DefaultZoieVersion>> list=new ArrayList<DataEvent<String,DefaultZoieVersion>>(count);
     
      DefaultZoieVersion zvt = null;
      for (int i=0;i<count;++i)
      {
        zvt = new DefaultZoieVersion();
        zvt.setVersionId(i);
       
        list.add(new DataEvent<String,DefaultZoieVersion>(TestData.testdata[i], zvt));
      }
      memoryProvider.addEvents(list);
      idxSystem.syncWthVersion(10000, zvt);

      int repeat = 20;
      int idx = 0;
      int[] results = new int[repeat];
      int[] expected = new int[repeat];
      Arrays.fill(expected, count);

      // should be consumed by the idxing system
      Searcher searcher=null;
      MultiReader reader= null;
      List<ZoieIndexReader<IndexReader>> readers = null;
      for (int i=0;i<repeat;++i)
      {
        try
        {
          readers=idxSystem.getIndexReaders();
          reader=new MultiReader(readers.toArray(new IndexReader[readers.size()]),false);

//          for(int j=0; j<readers.size(); j++)
//          {
//            IndexReader ir = readers.get(j);
//            Map<String, String> commitData = IndexReader.getCommitUserData(ir.directory()); // = new HashMap<String,String>();
//            System.out.println("j:" + j + "ZoieTest: directory: " + ir.directory());
//            System.out.println("j:" + j + "ZoieTest: commitData(ZoieVersion): " + commitData); 
//          }
         
          searcher=new IndexSearcher(reader);

          TopDocs hits=searcher.search(q,10);
          results[idx++] = hits.totalHits;

        }
        finally
        {
          try{
            if (searcher != null){
              searcher.close();
              searcher = null;
              reader.close();
              reader = null;
            }
          }
          finally{
            idxSystem.returnIndexReaders(readers);
          }
        } 
        try {
          Thread.sleep(30);
        } catch (InterruptedException e) {
          e.printStackTrace();
       
      }

      assertEquals("maybe race condition in disk flush", Arrays.toString(expected), Arrays.toString(results));
    }
    catch(IOException ioe)
    {
      throw new ZoieException(ioe.getMessage());
    }
    finally
    {
      memoryProvider.stop();
      idxSystem.shutdown();
View Full Code Here

Examples of proj.zoie.api.ZoieException

    }
    catch(Exception e)
    {
      for(QueryThread queryThread : queryThreads)
      {
        if(queryThread.exception == null) throw new ZoieException(e);
      }
    }
    finally
    {
      memoryProvider.stop();
      idxSystem.shutdown();
      deleteDirectory(idxDir);
    }
    System.out.println(" done round");
    log.info(" done round");
    for(QueryThread queryThread : queryThreads)
    {
      if(queryThread.exception != null) throw new ZoieException(queryThread.exception);
    }
  }
View Full Code Here

Examples of proj.zoie.api.ZoieException

    {
      q=parser.parse(query);
    }
    catch (ParseException e)
    {
      throw new ZoieException(e.getMessage(),e);
    }

   
    try
    {
View Full Code Here

Examples of proj.zoie.api.ZoieException

        {
          // check if load manager thread is alive
          if(_loadMgrThread == null || !_loadMgrThread.isAlive())
          {
            ZoieHealth.setFatal();
            throw new ZoieException("load manager has stopped");
          }
         
          this.notifyAll(); // wake up load manager thread     
         
          try
View Full Code Here

Examples of proj.zoie.api.ZoieException

          while (_batchList.size() > _maxBatchSize)
          {
            // check if load manager thread is alive
            if(_loadMgrThread == null || !_loadMgrThread.isAlive())
            {
              throw new ZoieException("load manager has stopped");
            }
           
            try
            {
              this.wait(60000); // 1 min
View Full Code Here

Examples of proj.zoie.api.ZoieException

          long now1 = System.currentTimeMillis();
       
          if (timeOut<=0)
          {
            log.error("sync timed out");
            throw new ZoieException("timed out");         
          }
          try
          {
            long waittime = Math.min(200, timeOut);
            this.wait(waittime);
          }
          catch (InterruptedException e)
          {
            throw new ZoieException(e.getMessage());
          }
         
          long now2 = System.currentTimeMillis();
         
          timeOut -= (now2 - now1);
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.