Package net.sf.joafip.performance.items.entity

Examples of net.sf.joafip.performance.items.entity.ItemList


    // "runtime_perf/toDelete.txt"));
    String line;
    while ((line = reader.readLine()) != null) {// NOPMD
      reader.readLine();// skip one
      final int identifier = Integer.parseInt(line);
      final ItemList itemList = getItemList(session);
      final Item item = itemList.removeItem(identifier);
      if (item == null) {
        Exception closeException=null;
        try {
          reader.close();
        } catch (Exception exception) {
          closeException=exception;
        }
        throw new FilePersistenceException("must found #" + identifier
            + " to be deleted",closeException);
      }
      if (++count == BATCH_SIZE) {
        count = 0;
        session.close(EnumFilePersistenceCloseAction.SAVE);
        session.open();
        consistencyCheck();
        ++batchCount;
        logger.info("delete batch #" + batchCount);
      }
    }
    reader.close();
    session.close(EnumFilePersistenceCloseAction.SAVE);

    session.open();
    batchCount = 0;
    count = 0;
    reader = new BufferedReader(new FileReader(insertLogFilePath));
    // "runtime_perf/toSearch.txt"));
    while (reader.readLine() != null && (line = reader.readLine()) != null) {// NOPMD
      final int identifier = Integer.parseInt(line);
      final ItemList itemList = getItemList(session);
      final Item item = itemList.get(identifier);
      if (item == null) {
        throw new FilePersistenceException("must found #" + identifier
            + " because not deleted");
      }
      if (++count == BATCH_SIZE) {
        count = 0;
        session.close(EnumFilePersistenceCloseAction.SAVE);
        session.open();
        ++batchCount;
        logger.info("search batch #" + batchCount);
      }
    }
    reader.close();
    session.close(EnumFilePersistenceCloseAction.SAVE);

    session.open();
    batchCount = 0;
    count = 0;
    reader = new BufferedReader(new FileReader(insertLogFilePath));
    // "runtime_perf/toDelete.txt"));
    while ((line = reader.readLine()) != null) { // NOPMD
      reader.readLine();// skip
      final int identifier = Integer.parseInt(line);
      final ItemList itemList = getItemList(session);
      final Item item = itemList.getItem(identifier);
      if (item != null) {
        throw new FilePersistenceException("must not found #"
            + identifier + " because deleted");
      }
      if (++count == BATCH_SIZE) {
View Full Code Here


        inputStream));
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    // delete half of item
    ItemList itemList = getItemList(session);
    int count = 0;
    String line = reader.readLine();
    while (line != null) { // NOPMD
      count++;
      final int identifier = Integer.parseInt(line);
      Item removed = itemList.removeItem(identifier);
      if( removed==null){
        logger.error("not found "+identifier);
      }
      if (count % BATCH_SIZE == BATCH_SIZE - 1) {
        session.close(EnumFilePersistenceCloseAction.SAVE);
View Full Code Here

    itemTemplateList = getItemTemplateList(session);
    if (itemTemplateList == null) {
      itemTemplateList = new ItemTemplateList();
      session.setObject(ITEM_TEMPLATE_LIST, itemTemplateList);
    }
    ItemList itemList;
    itemList = getItemList(session);
    if (itemList == null) {
      itemList = new ItemList();
      session.setObject(ITEM_LIST, itemList);
    }
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
  }
View Full Code Here

    int count = 0;
    String line;
    while ((line = reader.readLine()) != null) { // NOPMD
      count++;
      final int identifier = Integer.parseInt(line);
      final ItemList itemList = getItemList(session);
      final long startSearchTime = System.currentTimeMillis();
      final Item item = itemList.get(identifier);
      if (item == null) {
        // throw new
        // IllegalStateException("missing item for identifier "
        // + identifier);
        logger.info("missing item for identifier " + identifier);
View Full Code Here

    reader.close();
    insertLogWriter.close();
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);

    session.open();
    final ItemList itemList = getItemList(session);
    itemList.removeItem(NUMBER_OF_ITEM);
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);

    FILE_FOR_LUC.delete();

    logSize(count, -1, duration);
View Full Code Here

  private void addItem(final IDataAccessSession session, final int identifier)
      throws FilePersistenceException {
    try {
      final Item item = new Item(identifier, null/* itemTemplate */,
          "item" + identifier);
      final ItemList itemList = getItemList(session);
      itemList.addItem(item);
    } catch (final RuntimeException exception) {
      logger.fatal("adding item " + identifier, exception);
      throw exception;
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.joafip.performance.items.entity.ItemList

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.