Package org.infinispan.atomic

Examples of org.infinispan.atomic.AtomicMap


   public void testAtomicHashMap() throws Exception {
      Cache cache1 = cache(0, "replQueue");
      Cache cache2 = cache(1, "replQueue");
      TransactionManager transactionManager = TestingUtil.getTransactionManager(cache1);
      transactionManager.begin();
      AtomicMap am = AtomicMapLookup.getAtomicMap(cache1, "foo");
      am.put("sub-key", "sub-value");
      transactionManager.commit();

      ReplQueueTestScheduledExecutorFactory.command.run();

      //in next 5 secs, expect the replication to occur
View Full Code Here


    * @throws Exception
    */
   private Set<FullyQualifiedSessionId> getSSOSessions(String ssoId) throws Exception
   {
      CacheKey key = new CacheKey(ssoId,CacheKey.Type.SESSION);
      AtomicMap m = AtomicMapLookup.getAtomicMap(cache, key, true);
      return m!=null ? m.keySet() : Collections.EMPTY_SET;
   }
View Full Code Here

    * @throws Exception
    */
   private void putSessionInCache(String ssoId, FullyQualifiedSessionId fullyQualifiedSessionId) throws Exception
   {
      CacheKey key = new CacheKey(ssoId,CacheKey.Type.SESSION);
      AtomicMap m = AtomicMapLookup.getAtomicMap(cache, key, true);
      m.put(fullyQualifiedSessionId, null);
   }
View Full Code Here

    * @throws Exception
    */
   private void removeSessionFromCache(String ssoId, FullyQualifiedSessionId fullyQualifiedSessionId) throws Exception
   {
      CacheKey key = new CacheKey(ssoId,CacheKey.Type.SESSION);
      AtomicMap m = AtomicMapLookup.getAtomicMap(cache, key, false);
      if (m != null)
      {
         m.remove(fullyQualifiedSessionId);
      }
   }
View Full Code Here

   }

   public void testAtomicHashMap() throws Exception {
      TransactionManager transactionManager = TestingUtil.getTransactionManager(cache1);
      transactionManager.begin();
      AtomicMap am = AtomicMapLookup.getAtomicMap(cache1, "foo");
      am.put("sub-key", "sub-value");
      transactionManager.commit();

      ReplicationQueue replicationQueue = TestingUtil.extractComponent(cache1, ReplicationQueue.class);
      replicationQueue.flush();
View Full Code Here

         Fqn parent = fqn.getSubFqn(0, i);
         Object childName = fqn.get(i);
         // make sure a data key exists in the cache
         assert c.containsKey(new NodeKey(parent, NodeKey.Type.DATA)) : "Node [" + parent + "] does not have a Data atomic map!";
         assert c.containsKey(new NodeKey(parent, NodeKey.Type.STRUCTURE)) : "Node [" + parent + "] does not have a Structure atomic map!";
         AtomicMap am = c.getAtomicMap(new NodeKey(parent, NodeKey.Type.STRUCTURE));
         boolean hasChild = am.containsKey(childName);
         assert hasChild : "Node [" + parent + "] does not have a child [" + childName + "] in its Structure atomic map!";
      }
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   public V remove(Fqn fqn, K key) {
      startAtomic();
      try {
         AtomicMap map = cache.getAtomicMap(new NodeKey(fqn, NodeKey.Type.DATA));
         return map == null ? null : (V) map.remove(key);
      }
      finally {
         endAtomic();
      }
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   public V remove(Fqn fqn, K key) {
      startAtomic();
      try {
         AtomicMap map = cache.getAtomicMap(new NodeKey(fqn, NodeKey.Type.DATA));
         return map == null ? null : (V) map.remove(key);
      }
      finally {
         endAtomic();
      }
   }
View Full Code Here

   public void testAtomicHashMap() throws Exception {
      Cache cache1 = cache(0, "replQueue");
      Cache cache2 = cache(1, "replQueue");
      TransactionManager transactionManager = TestingUtil.getTransactionManager(cache1);
      transactionManager.begin();
      AtomicMap am = AtomicMapLookup.getAtomicMap(cache1, "foo");
      am.put("sub-key", "sub-value");
      transactionManager.commit();

      ReplQueueTestScheduledExecutorFactory.command.run();

      //in next 5 secs, expect the replication to occur
View Full Code Here

   public void testAtomicHashMap() throws Exception {
      Cache cache1 = cache(0, "replQueue");
      Cache cache2 = cache(1, "replQueue");
      TransactionManager transactionManager = TestingUtil.getTransactionManager(cache1);
      transactionManager.begin();
      AtomicMap am = AtomicMapLookup.getAtomicMap(cache1, "foo");
      am.put("sub-key", "sub-value");
      transactionManager.commit();

      ReplQueueTestScheduledExecutorFactory.command.run();

      //in next 5 secs, expect the replication to occur
View Full Code Here

TOP

Related Classes of org.infinispan.atomic.AtomicMap

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.