Package org.jboss.cache.aop

Examples of org.jboss.cache.aop.PojoCache


   {
      log.debug("Starting JBoss POJO Cache 1.x");

      try
      {
         cache = new PojoCache();
         new org.jboss.cache.PropertyConfigurator().configure(cache, getConfigurationAsStream());
         cache.createService();
         cache.startService();

      }
View Full Code Here


   {
      log.debug("Starting JBoss POJO Cache 1.x");

      try
      {
         cache = new PojoCache();
         new org.jboss.cache.PropertyConfigurator().configure(cache, getConfigurationAsStream());
         cache.createService();
         cache.startService();

      }
View Full Code Here

   static long startTime_ = 0;
   static long endTime_ = 0;
   static int operationType_ = 1;

   void initCache() throws Exception {
      cache_ = new PojoCache();
      PropertyConfigurator config = new PropertyConfigurator();
      String file = (String)props_.get("cache_config");
      if(file==null)
      {
         throw new RuntimeException("Cache config xml is not specified.");
View Full Code Here

      cache1_.stop();
      cache2_.stop();
   }

   private PojoCache createCache(String name) throws Exception {
      PojoCache tree = new PojoCache();
      PropertyConfigurator config = new PropertyConfigurator();   // configure the cache through injection
       // read in the replSync xml. Here we use synchronous mode replication.
      config.configure(tree, "META-INF/replSync-service.xml");
      tree.setClusterName(name); // We can set a different cluster group.
      tree.start(); // kick start the cache
      return tree;
   }
View Full Code Here

      cache1_.stop();
      cache2_.stop();
   }

   private PojoCache createCache(String name) throws Exception {
      PojoCache tree = new PojoCache();
      PropertyConfigurator config = new PropertyConfigurator();   // configure the cache through injection
       // read in the replSync xml. Here we use synchronous mode replication.
      config.configure(tree, "META-INF/replSync-service.xml");
      tree.setClusterName(name); // We can set a different cluster group.
      tree.start(); // kick start the cache
      return tree;
   }
View Full Code Here

   static long startTime_ = 0;
   static long endTime_ = 0;
   static int operationType_ = 1;

   void initCache() throws Exception {
      cache_ = new PojoCache();
      PropertyConfigurator config = new PropertyConfigurator();
      String file = (String)props_.get("cache_config");
      if(file==null)
      {
         throw new RuntimeException("Cache config xml is not specified.");
View Full Code Here

      cache1_.stop();
      cache2_.stop();
   }

   private PojoCache createCache(String name) throws Exception {
      PojoCache tree = new PojoCache();
      PropertyConfigurator config = new PropertyConfigurator();   // configure the cache through injection
       // read in the replSync xml. Here we use synchronous mode replication.
      config.configure(tree, "META-INF/replSync-service.xml");
      tree.setClusterName(name); // We can set a different cluster group.
      tree.start(); // kick start the cache
      return tree;
   }
View Full Code Here

  
   public void testInitialStateTransfer() throws Exception
   {
      log.info("Enter testInitialStateTransfer");
     
      PojoCache cache1 = createCache("cache1", false, false, false);

      cache1.putObject(A_B_1, joe);
      cache1.putObject(A_B_2, jane);
      cache1.putObject(A_C_1, bob);
      cache1.putObject(A_C_2, jill);
     
      PojoCache cache2 = createCache("cache2", false, false, false);

      // Pause to give caches time to see each other
      TestingUtil.blockUntilViewsReceived(new PojoCache[]
      {cache1, cache2}, 60000);

      Person ab1  = (Person) cache2.getObject(A_B_1);
      Person ab2 = (Person) cache2.getObject(A_B_2);
      Person ac1  = (Person) cache2.getObject(A_C_1);
      Person ac2 = (Person) cache2.getObject(A_C_2);
      assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
      assertEquals("City for /a/b/1 is Anytown", addr1.getCity(), ab1.getAddress().getCity());
      assertEquals("Name for /a/b/2 is Jane", jane.getName(), ab2.getName());
      assertEquals("City for /a/b/2 is Anytown", addr1.getCity(), ab2.getAddress().getCity());
      assertTrue("Joe and Jane have same Address", ab1.getAddress() == ab2.getAddress());
View Full Code Here

   public void testInitialStateTferWithLoader() throws Exception
   {
      log.info("Enter testInitialStateTferWithLoader");
     
      PojoCache cache1 = createCache("cache1", false, false, true);

      cache1.putObject(A_B_1, joe);
      cache1.putObject(A_B_2, jane);
      cache1.putObject(A_C_1, bob);
      cache1.putObject(A_C_2, jill);

      PojoCache cache2 = createCache("cache2", false, false, true);

      // Pause to give caches time to see each other
      TestingUtil.blockUntilViewsReceived(new PojoCache[]
      {cache1, cache2}, 60000);

      CacheLoader loader = cache2.getCacheLoader();

      assertEquals("Loader name for /a/b/1 is Joe", joe.getName(), loader.get(A_B_1).get("name"));
      assertEquals("Loader name for /a/b/2 is Jane", jane.getName(), loader.get(A_B_2).get("name"));
      assertEquals("Loader name for /a/c/1 is Joe", bob.getName(), loader.get(A_C_1).get("name"));
      assertEquals("Loader name for /a/c/2 is Jill", jill.getName(), loader.get(A_C_2).get("name"));
     
      Person ab1  = (Person) cache2.getObject(A_B_1);
      Person ab2 = (Person) cache2.getObject(A_B_2);
      Person ac1  = (Person) cache2.getObject(A_C_1);
      Person ac2 = (Person) cache2.getObject(A_C_2);
      assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
      assertEquals("City for /a/b/1 is Anytown", addr1.getCity(), ab1.getAddress().getCity());
      assertEquals("Name for /a/b/2 is Jane", jane.getName(), ab2.getName());
      assertEquals("City for /a/b/2 is Anytown", addr1.getCity(), ab2.getAddress().getCity());
      assertTrue("Joe and Jane have same Address", ab1.getAddress() == ab2.getAddress());
View Full Code Here

   public void testPartialStateTransfer() throws Exception
   {
      log.info("Enter testPartialStateTransfer");
     
      PojoCache cache1 = createCache("cache1", false, true, false);
      cache1.activateRegion("/a");

      cache1.putObject(A_B_1, joe);
      cache1.putObject(A_B_2, jane);

      PojoCache cache2 = createCache("cache2", false, true, false);

      // Pause to give caches time to see each other
      TestingUtil.blockUntilViewsReceived(new PojoCache[]
      {cache1, cache2}, 60000);
     
      assertNull("/a/b/1 not transferred per policy", cache2.getObject(A_B_1));
      assertNull("/a/b/2 not transferred per policy", cache2.getObject(A_B_2));

      cache2.activateRegion("/a/b");
     
      Person ab1  = (Person) cache2.getObject(A_B_1);
      Person ab2 = (Person) cache2.getObject(A_B_2);
      assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
      assertEquals("City for /a/b/1 is Anytown", joe.getAddress().getCity(), ab1.getAddress().getCity());
      assertEquals("Name for /a/b/2 is Jane", jane.getName(), ab2.getName());
      assertEquals("City for /a/b/2 is Anytown", jane.getAddress().getCity(), ab2.getAddress().getCity());     
      assertTrue("Address for Joe and Jane is the same object", ab1.getAddress() == ab2.getAddress());

      cache1.putObject(A_C_1, bob);
      cache1.putObject(A_C_2, jill);
     
      assertNull("/a/c/1 not transferred per policy", cache2.getObject(A_C_1));

      cache2.activateRegion("/a/c");
     
      Person ac1 = (Person) cache2.getObject(A_C_1);
      Person ac2 = (Person) cache2.getObject(A_C_2);
      assertEquals("Name for /a/c/1 is Bob", bob.getName(), ac1.getName());
      assertEquals("City for /a/c/1 is Fremont", addr2.getCity(), ac1.getAddress().getCity());
      assertEquals("Name for /a/c/2 is Jill", jill.getName(), ac2.getName());
      assertEquals("City for /a/c/2 is Fremont", addr2.getCity(), ac2.getAddress().getCity());
      assertTrue("Bob and Jill have same Address", ac1.getAddress() == ac2.getAddress());
View Full Code Here

TOP

Related Classes of org.jboss.cache.aop.PojoCache

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.