private void loadObjects(
     NamedCache cache, ObjectGenerator<?, ?> generator, long rangeStart, long rangeFinish) {
   cache = TxLite.ensureWriteable(cache);
   int putSize = 100;
   long blockTs = System.nanoTime();
   long blockStart = rangeStart;
   for (long i = rangeStart; i < rangeFinish; i += putSize) {
     if (i % 10000 == 0) {
       String stats = "";
       if (i > blockStart) {
         long blockSize = i - blockStart;
         long blockTime = System.nanoTime() - blockTs;
         double avg = (((double) blockSize) / blockTime) * TimeUnit.SECONDS.toNanos(1);
         stats =
             " block "
                 + blockSize
                 + " in "
                 + TimeUnit.NANOSECONDS.toMillis(blockTime)
                 + "ms, AVG: "
                 + avg
                 + " put/sec, "
                 + avg / putSize
                 + " tx/sec, batchSize "
                 + putSize;
       }
       //		        println("Done " + (i - rangeStart) + stats);
       println("Done " + cache.size() + stats);
       blockTs = System.nanoTime();
       blockStart = i;
     }
     long j = Math.min(rangeFinish, i + putSize);
     cache.putAll(generator.generate(i, j));
     TxLite.commit(cache);
   }
   //		TxLite.commit(cache);
   TxLite.closeSession(cache);
 }
  public void process() {

    System.setProperty("tangosol.pof.enabled", "false");
    //	    System.setProperty("tangosol.pof.config", "capacity-benchmark-pof-config.xml");
    System.setProperty("tangosol.coherence.cacheconfig", "tx-lite-test-cache-config.xml");
    System.setProperty("tangosol.coherence.distributed.localstorage", "false");

    try {
      final NamedCache cache = CacheFactory.getCache("t-objects");
      final ObjectGenerator<?, ?> generator = new SimpleDomainObjGenerator();
      //			final ObjectGenerator<?, ?> generator = new SimpleDomainObjGenerator(100);
      //			final ObjectGenerator<?, ?> generator = new SimpleDomainObjGenerator(400);

      //			cache.addIndex(new ReflectionExtractor("getA0"), false, null);
      //			cache.addIndex(new ReflectionExtractor("getAs"), false, null);

      //			System.out.println(CacheFactory.getClusterConfig().toString());

      //			long objectCount = 1000000;
      long objectCount = 100000;
      //			long objectCount = 200000;
      //			long objectCount = 10000;

      long rangeStart = 1000000;
      long rangeFinish = 1000000 + objectCount;

      println("Loading " + objectCount + " objects ...");
      loadObjects(cache, generator, rangeStart, rangeFinish);

      println("Loaded " + cache.size() + " objects");
      println(
          "Key binary size: "
              + ExternalizableHelper.toBinary(generator.generate(1, 2).keySet().iterator().next())
                  .length());
      println(
          "Value binary size: "
              + ExternalizableHelper.toBinary(generator.generate(1, 2).values().iterator().next())
                  .length());
      System.gc();
      println("Mem. usage " + ManagementFactory.getMemoryMXBean().getHeapMemoryUsage());

      //			checkAccess(cache, new EqualsFilter("getA0", new DomainObjAttrib("?")));
      //			checkAccess(cache, new EqualsFilter(new ReflectionPofExtractor("a0"), new
      // DomainObjAttrib("?")));
      //			checkAccess(cache, new EqualsFilter("getAs", Collections.EMPTY_LIST));
      //			checkAccess(cache, new ContainsAnyFilter("getAs", Collections.singleton(new
      // DomainObjAttrib("?"))));

      //			ContinuousQueryCache view = new ContinuousQueryCache(cache, new
      // EqualsFilter("getHashSegment", 0), true);
      //			System.out.println("View size " + view.size());
      //
      //			view.addIndex(new ReflectionExtractor("getA0"), false, null);
      //            checkAccess(view, new EqualsFilter("getA0", new DomainObjAttrib("?")));
      //            checkAccess(view, new EqualsFilter("getA1", new DomainObjAttrib("?")));

      while (true) {
        Thread.sleep(1000);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }