Package com.tangosol.net

Examples of com.tangosol.net.NamedCache


//      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", "true");
     
    try {
      final NamedCache cacheT = CacheFactory.getCache("t-objects");
//      final NamedCache cacheTF = CacheFactory.getCache("tf-objects");
      final NamedCache cacheTX = CacheFactory.getCache("tx-objects");
//      cache.addMapListener(new MapTriggerListener(new PrintMapTrigger()));

      println("Cache node has started");
      println("Objects in t-* cache: " + cacheT.size());
//      println("Objects in tf-* cache: " + cacheTF.size());
      println("Objects in tx-* cache: " + cacheTX.size());
     
      while(true) {
          String cmd = new BufferedReader(new InputStreamReader(System.in)).readLine();
        if ("EXIT".equals(cmd.toUpperCase())) {
            CacheFactory.getCluster().shutdown();
View Full Code Here


    try {
     
      System.setProperty("tangosol.coherence.distributed.localstorage", "false");
      System.setProperty("tangosol.coherence.cacheconfig", "event-benchmark-cache-config.xml");
     
      final NamedCache p1 = CacheFactory.getCache("pool-1");
      final NamedCache p2 = CacheFactory.getCache("pool-2");
      final NamedCache p3 = CacheFactory.getCache("pool-3");
      final NamedCache p4 = CacheFactory.getCache("pool-4");
     
      p1.clear();
      p2.clear();
      p3.clear();
      p4.clear();
     
      long objectCount = 50000;
      final int batchSize = 20;
      int threadCount = 4;
     
      final Object value = new String[]{"ABC", "EFG", "123", "890", "QWERTY"};
     
      p1.addMapListener(new MapListener() {
       
        @Override
        public void entryUpdated(MapEvent evt) {
        }
     
        @Override
        public void entryInserted(MapEvent evt) {
          p4.put(evt.getKey(), evt.getNewValue());
        }
     
        @Override
        public void entryDeleted(MapEvent evt) {
        }
      });

      p2.addMapListener(new MapListener() {
       
        @Override
        public void entryUpdated(MapEvent evt) {
        }
       
        @Override
        public void entryInserted(MapEvent evt) {
          p3.put(evt.getKey(), evt.getNewValue());
        }
       
        @Override
        public void entryDeleted(MapEvent evt) {
        }
      });

      p3.addMapListener(new MapListener() {
       
        @Override
        public void entryUpdated(MapEvent evt) {
        }
       
        @Override
        public void entryInserted(MapEvent evt) {
          p4.put(evt.getKey(), evt.getNewValue());
        }
       
        @Override
        public void entryDeleted(MapEvent evt) {
        }
      });

      ExecutorService service = Executors.newFixedThreadPool(threadCount);
     
      Thread.sleep(500);
     
            System.out.println("Start test");
           
            long startTimestamp = System.nanoTime();
            for(long i = 0; i != objectCount; i += batchSize) {
              final Long key = Long.valueOf(i);
              service.execute(new Runnable() {
          @Override
          public void run() {
            if (batchSize == 1) {
              p1.put(key, value);
            }
            else {
              Map<Long, Object> batch = new HashMap<Long, Object>();
              for(int j = 0; j != batchSize; ++j) {
                batch.put(key + j, value);
              }
              p1.putAll(batch);
            }
          }
        });
            }
           
            service.shutdown();
            service.awaitTermination(60, TimeUnit.SECONDS);
           
            System.out.println("Wait for cache");
           
            while(true) {
              if (p4.size() == objectCount) {
                break;
              }
              else {
                Thread.sleep(1);
              }
View Full Code Here

      System.setProperty("tangosol.coherence.distributed.localstorage", "false");

      // ***
      System.setProperty("event-benchmark-thread-count", "4");

      final NamedCache out = CacheFactory.getCache("out-pool");
      final NamedCache in = CacheFactory.getCache("in-pool");
      in.addMapListener(new MapListener() {
     
        @Override
        public void entryUpdated(MapEvent evt) {
          // ignore
        }
View Full Code Here

    try {
     
      System.setProperty("tangosol.coherence.distributed.localstorage", "false");
      System.setProperty("tangosol.coherence.cacheconfig", "event-benchmark-cache-config.xml");
     
      final NamedCache p1 = CacheFactory.getCache("pool-1");
      final NamedCache p2 = CacheFactory.getCache("pool-2");
      final NamedCache p3 = CacheFactory.getCache("pool-3");
      final NamedCache p4 = CacheFactory.getCache("pool-4");
     
      p1.clear();
      p2.clear();
      p3.clear();
      p4.clear();
     
      long objectCount = 50000;
      final int batchSize = 4;
      int threadCount = 1;
     
      final Object value = new String[]{"ABC", "EFG", "123", "890", "QWERTY"};
     
      startPooler(p1, p2);
      startPooler(p2, p3);
      startPooler(p3, p4);

      ExecutorService service = Executors.newFixedThreadPool(threadCount);
     
      Thread.sleep(500);
     
            System.out.println("Start test");
           
            long startTimestamp = System.nanoTime();
            for(long i = 0; i != objectCount; i += batchSize) {
              final Long key = Long.valueOf(i);
              service.execute(new Runnable() {
          @Override
          public void run() {
            if (batchSize == 1) {
              p1.put(key, value);
            }
            else {
              Map<Long, Object> batch = new HashMap<Long, Object>();
              for(int j = 0; j != batchSize; ++j) {
                batch.put(key + j, value);
              }
              p1.putAll(batch);
            }
          }
        });
            }
           
            service.shutdown();
            service.awaitTermination(60, TimeUnit.SECONDS);
           
            System.out.println("Wait for cache");
           
            while(true) {
              if (p4.size() == objectCount) {
                break;
              }
              else {
                Thread.sleep(1);
              }
View Full Code Here

      System.setProperty("tangosol.coherence.cacheconfig", "event-benchmark-cache-config.xml");
     
      // ***
      System.setProperty("event-benchmark-thread-count", "4");
     
      NamedCache out = CacheFactory.getCache("out-pool");
      NamedCache in = CacheFactory.getCache("in-pool");
     
      out.clear();
      in.clear();
     
      // ***
      int objectCount = 100000;     
      // ***
      int threadCount = 4;
View Full Code Here

      System.setProperty("tangosol.coherence.distributed.localstorage", "false");

      // ***
      System.setProperty("event-benchmark-thread-count", "4");

      final NamedCache out = CacheFactory.getCache("out-pool");
      final NamedCache in = CacheFactory.getCache("in-pool");
      
      System.out.println("Bouncer node started");
     
      while(true) {
        pump(out, in);
View Full Code Here

      System.setProperty("tangosol.coherence.cacheconfig", "event-benchmark-cache-config.xml");
     
      // ***
      System.setProperty("event-benchmark-thread-count", "4");
     
      NamedCache out = CacheFactory.getCache("out-pool");
      NamedCache in = CacheFactory.getCache("in-pool");
     
      out.clear();
      in.clear();
     
      final AtomicInteger counter = new AtomicInteger();
     
      out = new ContinuousQueryCache(in, new AlwaysFilter(), new MapListener() {
     
View Full Code Here

      System.setProperty("tangosol.coherence.cacheconfig", "event-benchmark-cache-config.xml");

      // ***
      System.setProperty("event-benchmark-thread-count", "4");
     
      final NamedCache p1 = CacheFactory.getCache("pool-1");
      final NamedCache p2 = CacheFactory.getCache("pool-2");
      final NamedCache p3 = CacheFactory.getCache("pool-3");
      final NamedCache p4 = CacheFactory.getCache("pool-4");
      final NamedCache pin = CacheFactory.getCache("in-pool");
      final NamedCache pout = CacheFactory.getCache("out-pool");
     
      System.out.println("Storage node started");
     
      while(true) {
        Thread.sleep(100);
View Full Code Here

      System.setProperty("tangosol.coherence.distributed.localstorage", "false");

      // ***
      System.setProperty("event-benchmark-thread-count", "4");

      final NamedCache out = CacheFactory.getCache("out-pool");
      final NamedCache in = CacheFactory.getCache("in-pool");
      in.addMapListener(new MapListener() {
     
        @Override
        public void entryUpdated(MapEvent evt) {
          // ignore
        }
View Full Code Here

  public void testFilterSearch() {
    TxManager txman = TxLite.getManager();
    TxSession writer = txman.openReadWriteSession();
   
    TxSession reader = txman.openReadOnlySession();
    NamedCache rrA = reader.connect(cacheA);
    NamedCache rcA = txman.toReadCommited(cacheA);
    NamedCache dirtyA = txman.toDirtyRead(cacheA);
   
    NamedCache writerA = writer.connect(cacheA);
    writerA.put("A", "A");
    writerA.put("B", "B");
    writerA.put("C", "C");
    writerA.put("D", "D");

    Filter f = new EqualsFilter(new FirstCharExtractor(), "A");
   
    Assert.assertEquals("[A]", writerA.keySet(f).toString());
    Assert.assertEquals("[A]", dirtyA.keySet(f).toString());
    Assert.assertEquals("[]", rrA.keySet(f).toString());
    Assert.assertEquals("[]", rcA.keySet(f).toString());
   
    writer.commit();
   
    Assert.assertEquals("[A]", writerA.keySet(f).toString());
    Assert.assertEquals("[A]", dirtyA.keySet(f).toString());
    Assert.assertEquals("[]", rrA.keySet(f).toString());
    Assert.assertEquals("[A]", rcA.keySet(f).toString());
   
    reader.commit();

    Assert.assertEquals("[A]", writerA.keySet(f).toString());
    Assert.assertEquals("[A]", dirtyA.keySet(f).toString());
    Assert.assertEquals("[A]", rrA.keySet(f).toString());
    Assert.assertEquals("[A]", rcA.keySet(f).toString());
   
    writer.commit();
View Full Code Here

TOP

Related Classes of com.tangosol.net.NamedCache

Copyright © 2018 www.massapicom. 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.