Package org.infinispan.manager

Examples of org.infinispan.manager.EmbeddedCacheManager


    return configuration ;
  }
 
  public static void test() {
   
    EmbeddedCacheManager cacheManager = new DefaultCacheManager(initGlobalConfiguration(), initConfiguration());
 
    Cache<String, String> cache = cacheManager.getCache("Hello");
   
    System.out.println(cache.getCacheManager().getAddress());
  }
View Full Code Here


public class HelloWorldNamedCache {

  public static void main(String[] args) {
   
    EmbeddedCacheManager manager = new DefaultCacheManager();
   
    manager.defineConfiguration("named-cache", new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LIRS).maxEntries(10).build());
   
    Cache<Object, Object> cache = manager.getCache("named-cache");
   
    for (int i = 0; i < 10; i++) {
      cache.put("key-" + i, new User(i, "Kylin Soong", "IT"));
    }
   
View Full Code Here

public class HelloWroldXmlConfiguredCache {

  public static void main(String[] args) throws IOException {

    EmbeddedCacheManager manager = new DefaultCacheManager("infinispan.xml");

    Cache<Object, Object> cache = manager.getCache("xml-configured-cache");

    for (int i = 0; i < 10; i++) {
      cache.put("key-" + i, new User(i, "Kylin Soong", "IT"));
    }
View Full Code Here

   @Override
   public SharedLocalYieldingClusterLockManager getLockManager(Cache<?, ?> cache)
   {
      if (cache.getConfiguration().getCacheMode().isClustered()) return null;
     
      EmbeddedCacheManager container = (EmbeddedCacheManager) cache.getCacheManager();
      String clusterName = container.getGlobalConfiguration().getClusterName();
     
      synchronized (this.lockManagers)
      {
         LockManagerEntry entry = this.lockManagers.get(clusterName);
        
         if (entry == null)
         {
            entry = new LockManagerEntry(cache);
           
            container.addListener(this);
           
            this.lockManagers.put(clusterName, entry);
         }

         entry.addCache(cache.getName());
View Full Code Here

               configFileContents.repaint();


               CacheListener cl = new CacheListener();
               cache.addListener(cl);
               EmbeddedCacheManager cacheManager = cache.getCacheManager();
               cacheManager.addListener(cl);
               updateClusterTable(cacheManager.getMembers());

               lifespanSpinner.setValue(cache.getCacheConfiguration().expiration().lifespan());
               maxIdleSpinner.setValue(cache.getCacheConfiguration().expiration().maxIdle());
               cacheContentsSizeLabel.setText("Cache contains " + cache.size() + " entries");
View Full Code Here

      }
      frame.setTitle(title);
   }

   private String getLocalAddress() {
      EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) cache.getCacheManager();
      Address a = cacheManager.getAddress();
      if (a == null) return "(LOCAL mode)";
      else return a.toString();
   }
View Full Code Here

      if (a == null) return "(LOCAL mode)";
      else return a.toString();
   }

   private String getClusterSize() {
      EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) cache.getCacheManager();
      List<Address> members = cacheManager.getMembers();
      return members == null || members.isEmpty() ? "N/A" : "" + members.size();
   }
View Full Code Here

            memberStates = new ArrayList<String>(m.size());
            for (Address a : m) {
               String extraInfo = "Member";
               // if this is the first member then this is the coordinator
               if (memberStates.isEmpty()) extraInfo += " (coord)";
               EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) cache.getCacheManager();
               if (a.equals(cacheManager.getAddress()))
                  extraInfo += " (me)";

               memberStates.add(extraInfo);
            }
         } else {
View Full Code Here

    hotrodServers = new HotRodServer[numServers];
   
    createCluster(hotRodCacheConfiguration(clusterConfig()), numberOfHotRodServers());

    for (int i = 0; i < numServers; i++) {
      EmbeddedCacheManager cm = cacheManagers.get(i);
      hotrodServers[i] = TestHelper.startHotRodServer(cm);
    }

    String servers = TestHelper.getServersString(hotrodServers);
View Full Code Here

*/
@Test(groups = "functional", testName = "persistence.jdbc.stringbased.NonStringKeyStateTransferTest")
public class NonStringKeyStateTransferTest extends AbstractCacheTest {

   public void testReplicatedStateTransfer() {
      EmbeddedCacheManager cm1 = null, cm2 = null;
      try {
         ConfigurationBuilder conf1 = NonStringKeyPreloadTest.createCacheStoreConfig(TwoWayPersonKey2StringMapper.class.getName(), false, true);
         conf1.clustering().cacheMode(CacheMode.REPL_SYNC);

         cm1 = TestCacheManagerFactory.createClusteredCacheManager(conf1);
         Cache<Person, String> c1 = cm1.getCache();
         Person mircea = new Person("markus", "mircea", 30);
         Person mircea2 = new Person("markus2", "mircea2", 30);

         c1.put(mircea, "mircea");
         c1.put(mircea2, "mircea2");
View Full Code Here

TOP

Related Classes of org.infinispan.manager.EmbeddedCacheManager

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.