Examples of IExclusiveDataAccessSession


Examples of net.sf.joafip.service.IExclusiveDataAccessSession

      FilePersistenceTooBigForSerializationException {

    filePersistence.setSubstituteObjectManager(SubstitutedBob.class,
        getSubstitutionClass(), createSubstituteObjectManager());

    final IExclusiveDataAccessSession session = filePersistence
        .createExclusiveDataAccessSession();

    session.open();

    SubstitutedBob bob = initialBob();
    saveDone = false;
    session.setObject(KEY, bob);
    assertSaved();
    bob = null;// NOPMD unreference
    session.save();// force bob unload
    bob = (SubstitutedBob) session.getObject(KEY);
    assertNotNull("must retrieve object", bob);

    saveDone = false;
    final BobContainer bobContainer = (BobContainer) bob.getObject1();
    // assertSaved(); no auto save, bob is not a proxy
View Full Code Here

Examples of net.sf.joafip.service.IExclusiveDataAccessSession

      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException, RBTException {
    final IFilePersistence filePersistence = createFilePersistence();
    // filePersistence.setAutoSaveEventListener(this);
    final IExclusiveDataAccessSession session = filePersistence
        .createExclusiveDataAccessSession();
    final IInstanceFactory instanceFactory = session.getInstanceFactory();

    session.open();

    try {
      final RBTree tree = RBTree.newInstance(instanceFactory);
      session.setObject("tree", tree);

      for (int count = 0; count < 1000000; count++) {
        tree.append("" + count);// NOPMD
        if (count % 1000 == 0) {
          System.out.println("c=" + count);// NOPMD
        }
        if (count > 8) {
          tree.remove("" + (count - 8));// NOPMD
        }
      }
    } catch (Exception e) {
      e.printStackTrace();// NOPMD
    } finally {
      session.close();
    }

    filePersistence.xmlExport("runtime", "runtime/temp", false);
    filePersistence.close();
  }
View Full Code Here

Examples of net.sf.joafip.service.IExclusiveDataAccessSession

      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException {
    final int max = 10000;
    final IExclusiveDataAccessSession session = filePersistence
        .createExclusiveDataAccessSession();
    session.open();
    List<Integer> bigList = new PLinkedList<Integer>(); // bigList instance
    // is in memory
    for (int count = 0; count < max; count++) {
      final int value = aValue(count);
      bigList.add(value); // this make bigList growing in memory
    }
    session.setObject("myBigList", bigList);
    bigList = null; // NOPMD no more reference the big list
    session.save(); // after this the garbage collector can free memory of
    // the big list
    bigList = (List<Integer>) session.getObject("myBigList"); // witchery of
    // lazy load
    // : all the
    // big list
    // is not
    // loaded in
    // memory
    for (final int value : bigList) { // iteration make bigList growing in
                      // memory
      doSomething(value);
    }
    session.close();
  }
View Full Code Here

Examples of net.sf.joafip.service.IExclusiveDataAccessSession

      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException {
    final int max = 100000;
    final IExclusiveDataAccessSession session = filePersistence
        .createExclusiveDataAccessSession();
    session.open();
    // List<Integer> bigList = new PLinkedList<Integer>(); // bigList
    // instance
    // // is in memory
    session.setObject("myBigList", new PLinkedList<Integer>());// NOPMD
    session.save();
    List<Integer> bigList = (List<Integer>) session.getObject("myBigList");
    for (int count = 0; count < max; count++) {
      final int value = aValue(count);
      bigList.add(value); // this make bigList growing in memory
      if (count % 100 == 1) {
        session.save();
        final int numberOfObjectState = filePersistence
            .getNumberOfObjectState();
        System.out.println(count + " " + numberOfObjectState);// NOPMD
      }
    }
    session.save();
    System.out.println("--- iterate ---");// NOPMD
    session.setObject("myBigList", bigList);
    bigList = null; // NOPMD no more reference the big list
    session.save(); // after this the garbage collector can free memory of
    // the big list
    bigList = (List<Integer>) session.getObject("myBigList"); // witchery of
    // lazy load
    // : all the
    // big list
    // is not
    // loaded in
    // memory
    int count = 0;
    for (final int value : bigList) {
      doSomething(value);
      if (count % 100 == 1) {
        session.save();
        final int numberOfObjectState = filePersistence
            .getNumberOfObjectState();
        System.out.println(count + " " + numberOfObjectState);// NOPMD
      }
      count++;
    }
    session.close();
  }
View Full Code Here

Examples of net.sf.joafip.service.IExclusiveDataAccessSession

      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException {
    final int max = 10000;
    final IExclusiveDataAccessSession session = filePersistence
        .createExclusiveDataAccessSession();
    session.open();
    // List<Integer> bigList = new PLinkedList<Integer>(); // bigList
    // instance
    // // is in memory
    session.setObject("myBigList", new PLinkedList<Integer>());// NOPMD
    session.save();
    List<Integer> bigList = (List<Integer>) session.getObject("myBigList");
    for (int count = 0; count < max; count++) {
      final int value = aValue(count);
      bigList.add(value); // this make bigList growing in memory
      if (count % 100 == 1) {
        session.save();
        final int numberOfObjectState = filePersistence
            .getNumberOfObjectState();
        System.out.println(count + " " + numberOfObjectState);// NOPMD
      }
    }
    session.save();
    System.out.println("--- iterate ---");// NOPMD
    session.setObject("myBigList", bigList);
    bigList = null; // NOPMD no more reference the big list
    session.save(); // after this the garbage collector can free memory of
    // the big list
    bigList = (List<Integer>) session.getObject("myBigList"); // witchery of
    // lazy load
    // : all the
    // big list
    // is not
    // loaded in
    // memory
    for (final int value : bigList) { // iteration make bigList growing in
                      // memory
      doSomething(value);
    }
    session.close();
  }
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.