// System.setProperty("benchmark-default-scheme", "replicated-near-scheme");
//ExecutorService executor = Executors.newCachedThreadPool();
try {
final NamedCache cache = CacheFactory.getCache("objects");
// final Map map = cache;
// final Map map = new ContinuousQueryCache(cache, new ClassFilter(DomainObject.class), true);
// final Map map = new ConcurrentHashMap();
// final Map map = new HashMap();
final Map map = new ConcurrentSkipListMap();
// final Map map = Collections.synchronizedMap(new HashMap());
final ObjectGenerator<?, ?> generator = new SimpleDomainObjGenerator();
// cache.addIndex(new ReflectionExtractor("getA0"), false, null);
// cache.addIndex(new ReflectionExtractor("getAs"), false, null);
// long objectCount = 1000000;
long objectCount = 100000;
long rangeStart = 0;
long rangeFinish = objectCount;
println("Loading " + objectCount + " objects ...");
for(long i = rangeStart; i < rangeFinish; i += 100) {
if (i % 100000 == 0) {
println("Done " + (i - rangeStart));
}
long j = Math.min(rangeFinish, i + 100);
map.putAll(generator.generate(i, j));
}
println("Loaded " + cache.size() + " objects");
System.gc();
println("Mem. usage " + ManagementFactory.getMemoryMXBean().getHeapMemoryUsage());
// checkAccess(cache, new EqualsFilter("getA0", new DomainObjAttrib("?")));
// checkAccess(cache, new EqualsFilter("getAs", Collections.EMPTY_LIST));