// Much better Fqn f = Fqn.fromString("/a/b/c"); for (int i=0; i @author (various) @since 4.0
// Much better Fqn f = Fqn.fromString("/a/b/c"); for (int i=0; i @version $Revision: 6776 $
103104105106107108109110111112113
configureCache( "cache.async.queueSize=1\n" + "cache.async.pollWait=10\n" + "", true); CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader(); Fqn fqn = Fqn.fromString("/bound"); loader.remove(fqn); // You can't really see it block though :-/ for (int i = 0; i < 50; i++) { cache.put(fqn, "key" + i, "value1");
138139140141142143144145146147148
} public void testStoreState() throws Exception { configureCache("", false); Fqn X = Fqn.fromString("/x"); CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader(); loader.remove(X); cache.put(X, "key1", "value1"); ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); MarshalledValueOutputStream os = new MarshalledValueOutputStream(baos);
319320321322323324325326327328329
} return; } // the first worker would create a new node for the FQN // all the others would update the same node Fqn fqn = Fqn.fromString("/NODE/" + i); for (int m = 0; m < m_modificationsPerTx; m++) { cache.put(fqn, m, i); if (checkAndSetState()) {
165166167168169170171172173174175
configureCache( "cache.async.queueSize=1\n" + "cache.async.pollWait=10\n" + "cache.async.threadPoolSize=5", true); CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader(); Fqn fqn = Fqn.fromString("/bound"); loader.remove(fqn); // You can't really see it block though :-/ for (int i = 0; i < 50; i++) { cache.put(fqn, "key" + i, "value1");
190191192193194195196197198199200
debugMessage("Did a put on " + name + ", data is " + n.data); } private void recursivelyPutParentsIfNeeded(Fqn node) { Fqn parent = node.getParent(); if (getNodesMap().containsKey(parent)) return; // nothing to do. // else put the parent in. getNodesMap().put(parent, new DummyNode(parent)); recursivelyPutParentsIfNeeded(parent);
190191192193194195196197198199
Cache<String, String> cacheJmx = (Cache<String, String>) mBeanServer.getAttribute(mBeanName, "Cache"); cacheJmx.getRoot().put("key", "value"); assertEquals("value", cache.getRoot().get("key")); Fqn fqn = Fqn.fromString("/testing/jmx"); cache.put(fqn, "key", "value"); assertEquals("value", cacheJmx.get(fqn, "key")); }
338339340341342343344345346347348
{ CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(); // have to start the cache before we'll have a root cache.start(); Fqn fqn = Fqn.fromString("/testing/jmx"); cache.put(fqn, "foobar", "barfoo"); assertEquals("barfoo", cache.get(fqn, "foobar")); String details = html ? wrapper.printCacheDetailsAsHtml() : wrapper.printCacheDetails();
370371372373374375376377378379380
TransactionManager tm = config.getRuntimeConfig().getTransactionManager(); tm.begin(); try { Fqn fqn = Fqn.fromString("/testing/jmx"); cache.put(fqn, "foobar", "barfoo"); String locks = html ? wrapper.printLockInfoAsHtml() : wrapper.printLockInfo(); assertTrue("Details include testing", locks.contains("testing"));
5152535455565758596061
{ Cache<Object, Object>[] caches = cachesTL.get(); assertClusterSize("Should only be 2 caches in the cluster!!!", 2); assertInvocationContextInitState(); Fqn f = Fqn.fromString("/test/data"); String k = "key", v = "value"; assertNull("Should be null", caches[0].getRoot().getChild(f)); assertNull("Should be null", caches[1].getRoot().getChild(f));
7778798081828384858687
{ Cache<Object, Object>[] caches = cachesTL.get(); assertClusterSize("Should only be 2 caches in the cluster!!!", 2); assertInvocationContextInitState(); Fqn fqn = Fqn.fromString("/JSESSIONID/1010.10.5:3000/1234567890/1"); caches[0].getConfiguration().setSyncCommitPhase(true); caches[1].getConfiguration().setSyncCommitPhase(true); caches[0].put(fqn, "age", 38); assertEquals("Value should be set", 38, caches[0].get(fqn, "age"));