Package org.infinispan.transaction.lookup

Examples of org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup


                .build(); //Builds  the GlobalConfiguration object
            Configuration loc = new ConfigurationBuilder()
                .jmxStatistics().enable() //Enable JMX statistics
                .clustering().cacheMode(CacheMode.LOCAL) //Set Cache mode to LOCAL - Data is not replicated
                .transaction().transactionMode(TransactionMode.TRANSACTIONAL).autoCommit(false) //Enable Transactional mode with autocommit false
                .lockingMode(LockingMode.OPTIMISTIC).transactionManagerLookup(new JBossStandaloneJTAManagerLookup()) //uses JBossStandaloneJTAManagerLookup - If you're running Infinispan in a standalone environment, this should be your default choice for transaction manager. It's a fully fledged transaction manager based on JBoss Transactions which overcomes all the deficiencies of the dummy transaction manager.
                .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) //Sets the isolation level of locking
                .eviction().maxEntries(4).strategy(EvictionStrategy.LIRS) //Sets  4 as maximum number of entries in a cache instance and uses the LIRS strategy - an efficient low inter-reference recency set replacement policy to improve buffer cache performance
                .loaders().passivation(false).addFileCacheStore().purgeOnStartup(true) //Disable passivation and adds a FileCacheStore that is purged on Startup
                .build(); //Builds the Configuration object
            manager = new DefaultCacheManager(glob, loc, true);
View Full Code Here


     */
    private TransactionManagerLookup getTransactionManagerLookup() {
        if (new J2EEServerInfo().isJBoss()) {
            return new JBossTransactionManagerLookup();
        } else {
            return new JBossStandaloneJTAManagerLookup();
        }
    }
View Full Code Here

      String property = JTA;
      if (!DUMMY_TM.equalsIgnoreCase(property)) {
         System.out.println("Transaction manager used: JBossTM");

         final String lookup = JBossStandaloneJTAManagerLookup.class.getName();
         final JBossStandaloneJTAManagerLookup instance = new JBossStandaloneJTAManagerLookup();
         operations = new Operations() {
            public UserTransaction getUserTransaction() {
               try {
                  return instance.getUserTransaction();
               }
               catch (Exception e) {
                  throw new RuntimeException(e);
               }
            }

            public void cleanup() {
            }

            public String getLookup() {
               return lookup;
            }

            public TransactionManager getManager() {
               try {
                  return instance.getTransactionManager();
               }
               catch (Exception e) {
                  throw new RuntimeException(e);
               }
            }
         };
      } else {
         System.out.println("Transaction manager used: Dummy");
         final String lookup = DummyTransactionManagerLookup.class.getName();
         final DummyTransactionManagerLookup instance = new DummyTransactionManagerLookup();
         operations = new Operations() {
            public UserTransaction getUserTransaction() {
               return instance.getUserTransaction();
            }

            public void cleanup() {
               instance.cleanup();
            }

            public String getLookup() {
               return lookup;
            }

            public TransactionManager getManager() {
               try {
                  return instance.getTransactionManager();
               }
               catch (Exception e) {
                  throw new RuntimeException(e);
               }
View Full Code Here

   @Override
   protected void createCacheManagers() {
      ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true, true);
      builder.transaction()
            .transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC)
            .transactionManagerLookup(new JBossStandaloneJTAManagerLookup())
            .eviction().maxEntries(1).strategy(EvictionStrategy.LRU)
            .loaders()
            .addStore().cacheStore(new DummyInMemoryCacheStore())
            .fetchPersistentState(false);
View Full Code Here

   @Override
   protected void createCacheManagers() {
      ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true, true);
      builder.transaction()
            .transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC)
            .transactionManagerLookup(new JBossStandaloneJTAManagerLookup())
            .eviction().maxEntries(1).strategy(EvictionStrategy.LRU)
            .loaders().passivation(true)
            .addStore().cacheStore(new DummyInMemoryCacheStore())
            .fetchPersistentState(false);
View Full Code Here

      String property = JTA;
      if (!DUMMY_TM.equalsIgnoreCase(property)) {
         System.out.println("Transaction manager used: JBossTM");

         final String lookup = JBossStandaloneJTAManagerLookup.class.getName();
         final JBossStandaloneJTAManagerLookup instance = new JBossStandaloneJTAManagerLookup();
         operations = new Operations() {
            @Override
            public UserTransaction getUserTransaction() {
               try {
                  return instance.getUserTransaction();
               }
               catch (Exception e) {
                  throw new RuntimeException(e);
               }
            }

            @Override
            public void cleanup() {
            }

            @Override
            public String getLookup() {
               return lookup;
            }


            @Override
            public TransactionManagerLookup lookup() {
               return instance;
            }

            @Override
            public TransactionManager getManager() {
               try {
                  return instance.getTransactionManager();
               }
               catch (Exception e) {
                  throw new RuntimeException(e);
               }
            }

         };
      } else {
         System.out.println("Transaction manager used: Dummy");
         final String lookup = DummyTransactionManagerLookup.class.getName();
         final DummyTransactionManagerLookup instance = new DummyTransactionManagerLookup();
         operations = new Operations() {
            @Override
            public UserTransaction getUserTransaction() {
               return instance.getUserTransaction();
            }

            @Override
            public void cleanup() {
               instance.cleanup();
            }

            @Override
            public String getLookup() {
               return lookup;
            }

            @Override
            public TransactionManagerLookup lookup() {
               return instance;
            }

            @Override
            public TransactionManager getManager() {
               try {
                  return instance.getTransactionManager();
               }
               catch (Exception e) {
                  throw new RuntimeException(e);
               }
View Full Code Here

   @Override
   protected void createCacheManagers() {
      ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true, true);
      builder.transaction()
            .transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC)
            .transactionManagerLookup(new JBossStandaloneJTAManagerLookup())
            .eviction().maxEntries(1).strategy(EvictionStrategy.LRU)
            .persistence().passivation(true)
            .addStore(DummyInMemoryStoreConfigurationBuilder.class)
            .fetchPersistentState(false);
View Full Code Here

   @Override
   protected void createCacheManagers() {
      ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true, true);
      builder.transaction()
            .transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC)
            .transactionManagerLookup(new JBossStandaloneJTAManagerLookup())
            .eviction().maxEntries(1).strategy(EvictionStrategy.LRU)
            .persistence()
            .addStore(DummyInMemoryStoreConfigurationBuilder.class)
            .fetchPersistentState(false);
View Full Code Here

   public void testDummyTransactionManagerLookup() throws Exception {
      doTest(new DummyTransactionManagerLookup());
   }

   public void testJBossStandaloneJTAManagerLookup() throws Exception {
      JBossStandaloneJTAManagerLookup lookup = new JBossStandaloneJTAManagerLookup();
      lookup.init(configuration);
      doTest(lookup);
   }
View Full Code Here

      if (startedInCmdLine) cacheManager = createCacheManager();
   }

   private ConfigurationBuilder getBaseCfg() {
      ConfigurationBuilder cfg = new ConfigurationBuilder();
      cfg.locking().concurrencyLevel(5000).transaction().transactionManagerLookup(new JBossStandaloneJTAManagerLookup());
      return cfg;
   }
View Full Code Here

TOP

Related Classes of org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup

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.