You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Konstantinov (JIRA)" <ji...@apache.org> on 2015/08/17 10:52:45 UTC

[jira] [Created] (IGNITE-1256) Zero heap metrics for cache with near cache

Pavel Konstantinov created IGNITE-1256:
------------------------------------------

             Summary: Zero heap metrics for cache with near cache
                 Key: IGNITE-1256
                 URL: https://issues.apache.org/jira/browse/IGNITE-1256
             Project: Ignite
          Issue Type: Bug
          Components: cache
    Affects Versions: ignite-1.4
            Reporter: Pavel Konstantinov
            Assignee: Yakov Zhdanov


Start server node with partitioned cache with near cache.
Put some keys.
Verify heap memory size metric.

{code}
public class CachePutGetExample {
    /**
     * Executes example.
     *
     * @param args Command line arguments, none required.
     * @throws IgniteException If example execution failed.
     */
    public static void main(String[] args) throws IgniteException {
        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
            try
            {
                NearCacheConfiguration<Integer, String> nCfg = new NearCacheConfiguration<Integer, String>();
                nCfg.setNearEvictionPolicy(new LruEvictionPolicy<Integer, String>(100));
                CacheConfiguration<Integer, String> cfg = new CacheConfiguration<Integer, String>("myCache");
                cfg.setNearConfiguration(nCfg);
//                cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
                IgniteCache<Integer,String> cache = ignite.getOrCreateCache(cfg);

                // Individual puts and gets.
                System.out.println();
                System.out.println(">>> Cache put-get example started.");

                final int keyCnt = 20000;

                // Store keys in cache.
                for (int i = 0; i < keyCnt; i++)
                    cache.put(i, Integer.toString(i));

                System.out.println(">>> Stored values in cache.");

                for (int i = 0; i < keyCnt; i++)
                    System.out.println("Got [key=" + i + ", val=" + cache.get(i) + ']');

                try {
                    Thread.sleep(1000000000);
                }
                catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }

{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)