Hi,

Could someone please explain this unexpected behavior using standalone JBoss 
Cache v1.2.3: 
- I add a Map object to a TreeCacheAOP instance
- Retrieve the Map from the cache and call get method on map
- Just calling get causes the key queried for to be added to the Map. This does 
not follow the contract of standard Java Maps.

Output of the System.out lines in the below sample:
...
false
true


  | import java.util.HashMap;
  | import java.util.Map;
  | 
  | import org.jboss.cache.PropertyConfigurator;
  | import org.jboss.cache.aop.TreeCacheAop;
  | 
  | public class CacheMapTest {
  | 
  |     private static final String DB_TEST_MAP = "/db/testMap";
  | 
  |     private static final String MY_KEY = "myKey";
  | 
  |     public static void main(String[] args) throws Exception {
  |             TreeCacheAop cache = new TreeCacheAop();
  |             PropertyConfigurator config = new PropertyConfigurator();
  |             config.configure(cache, "META-INF/replSync-service.xml");
  |             cache.startService();
  | 
  |             cache.putObject(DB_TEST_MAP, new HashMap());
  | 
  |             Map testMap = (Map) cache.getObject(DB_TEST_MAP);
  |             System.out.println(testMap.containsKey(MY_KEY));
  |             testMap.get(MY_KEY);
  |             System.out.println(testMap.containsKey(MY_KEY));
  |     }
  | 
  | }
  | 

Thanks!


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3886101#3886101

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3886101


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to