Package proj.zoie.impl.indexing

Examples of proj.zoie.impl.indexing.ZoieSystem


      return false;
    }

    // offline line index is not moving, so MMAP should be the most efficient.
    DirectoryManager dirMgr = new DefaultDirectoryManager(dest, DIRECTORY_MODE.MMAP);
    Zoie<R, D> zoie = new ZoieSystem(dirMgr, _interpreter, _decorator, _zoieConfig);
    if (_running) zoie.start();

    if (_zoieOne != null) {
      final Zoie toBeShutdown = _zoieOne;
      _zoieOne = zoie;
View Full Code Here


        }, zConfig);
    HourglassAdmin mbean = new HourglassAdmin(hourglass);
    Object readerManager = getFieldValue(hourglass, "_readerMgr");
    Object maintenanceThread = getFieldValue(readerManager, "maintenanceThread");
    Runnable runnable = (Runnable) getFieldValue(maintenanceThread, "target");
    ZoieSystem currentZoie = (ZoieSystem) getFieldValue(hourglass, "_currentZoie");
    MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
    try {
      mbeanServer.registerMBean(mbean, new ObjectName("HouseGlass:name=hourglass"));
    } catch (Exception e) {
      System.out.println(e);
    }
    MemoryStreamDataProvider<String> memoryProvider = new MemoryStreamDataProvider<String>(
        ZoieConfig.DEFAULT_VERSION_COMPARATOR);
    memoryProvider.setMaxEventsPerMinute(Long.MAX_VALUE);
    memoryProvider.setDataConsumer(hourglass);
    memoryProvider.start();

    Thread.sleep(200); // wait freshness time for zoie readers.

    int initNumDocs = getTotalNumDocs(hourglass);
    System.out.println("initial number of DOCs: " + initNumDocs);
    boolean wait = false;
    for (int i = initNumDocs; i < initNumDocs + 1200; i++) {
      List<DataEvent<String>> list = new ArrayList<DataEvent<String>>(2);
      list.add(new DataEvent<String>("" + i, "" + i));
      memoryProvider.addEvents(list);
      System.out.println((i - initNumDocs + 1) + " of " + (1200 - initNumDocs));
      if (idxDir.exists()) {
        int numDirs = idxDir.listFiles().length;
        if (numDirs > maxDirs) {
          System.out.println("Set maxDirs to " + numDirs);
          maxDirs = numDirs;
        }
        if (maxDirs >= trimThreshold + 2) {
          wait = true;
          if (numDirs < minDirs) {
            boolean stop = false;

            // We want to make sure that number of directories does shrink
            // to trimThreshold + 1. Exactly when trimming is done is
            // controlled by HourglassReaderManager, which checks trimming
            // condition only once per minute.
            System.out.println("Set minDirs to " + numDirs);
            minDirs = numDirs;
            if (minDirs == 2) {
              stop = true;
            }
            if (stop) {
              System.out.println("TrimmingTest succeeded, terminate the loop.");
              break;
            }
          }
        }
      }
      synchronized (currentZoie) {
        currentZoie.notifyAll();
      }
      if (wait) {
        Thread.sleep(1000);
      }
      synchronized (runnable) {
View Full Code Here

TOP

Related Classes of proj.zoie.impl.indexing.ZoieSystem

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.