예제 #1
0
  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();
    }
  }
예제 #2
0
 public void readExternal(DataInput in) throws IOException {
   this.message = ExternalizableHelper.readSafeUTF(in);
   this.severity = ExternalizableHelper.readInt(in);
 }
예제 #3
0
 public void writeExternal(DataOutput out) throws IOException {
   ExternalizableHelper.writeSafeUTF(out, message);
   ExternalizableHelper.writeInt(out, severity);
 }
 @Override
 public Object serDeser(Object value) {
   Binary bin = ExternalizableHelper.toBinary(value, ctx1);
   return ExternalizableHelper.fromBinary(bin, ctx2);
 }