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("Cache size: " + cache.size());
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("?")));