Package net.sf.ehcache.config

Examples of net.sf.ehcache.config.Configuration


                byURI = new ConcurrentHashMap<URI, JCacheManager>();
                cacheManagers.put(classLoader, byURI);
            }
            cacheManager = byURI.get(uri);
            if(cacheManager == null) {
                final Configuration configuration = ConfigurationFactory.parseConfiguration(configurationURL);
                if(configuration.getName() == null) {
                    configuration.setName(uri.toString() + "::" + classLoader.toString() + "::" + this.toString());
                }
                configuration.setClassLoader(classLoader);
                final net.sf.ehcache.CacheManager ehcacheManager = new net.sf.ehcache.CacheManager(configuration);
                cacheManager = new JCacheManager(this, ehcacheManager, uri, properties);
                byURI.put(uri, cacheManager);
            }
        }
View Full Code Here


    protected static CacheManager CACHE_MANAGER;

    @BeforeClass
    public static void setUpGlobal() {
        final Configuration config = new Configuration();
        config.addDefaultCache(
                new CacheConfiguration("default", Integer.MAX_VALUE)
                    .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
                    .overflowToDisk(false));
        CACHE_MANAGER = CacheManager.create(config);
    }
View Full Code Here

      }
    }
    else {
      url = this.getClass().getResource( Environment.DEFAULT_CONFIG );
    }
    final Configuration configuration = ConfigurationFactory.parseConfiguration( url );
    if ( jtaPlatform != null ) {
      OgmTransactionManagerLookupDelegate.transactionManager = jtaPlatform.retrieveTransactionManager();
      final FactoryConfiguration transactionManagerLookupParameter = new FactoryConfiguration();
      transactionManagerLookupParameter.setClass( OgmTransactionManagerLookupDelegate.class.getName() );
      configuration.addTransactionManagerLookup( transactionManagerLookupParameter );
    }
    cacheManager = CacheManager.create( url );
  }
View Full Code Here

                                configurationResourceName
                        );
                    }
                    url = loadResource( configurationResourceName );
                }
                Configuration configuration = HibernateUtil.loadAndCorrectConfiguration( url );
                manager = CacheManager.create( configuration );
                REFERENCE_COUNT.incrementAndGet();
            }
            mbeanRegistrationHelper.registerMBean( manager, properties );
        }
View Full Code Here

    this.jtaPlatform = serviceRegistryImplementor.getService( JtaPlatform.class );
  }

  @Override
  public void start() {
    final Configuration configuration = ConfigurationFactory.parseConfiguration( config.getUrl() );
    if ( jtaPlatform != null ) {
      OgmTransactionManagerLookupDelegate.transactionManager = jtaPlatform.retrieveTransactionManager();
      final FactoryConfiguration transactionManagerLookupParameter = new FactoryConfiguration();
      transactionManagerLookupParameter.setClass( OgmTransactionManagerLookupDelegate.class.getName() );
      configuration.addTransactionManagerLookup( transactionManagerLookupParameter );
    }
    cacheManager = CacheManager.create( config.getUrl() );

    entityCache = new Cache<SerializableKey>( cacheManager.getCache( DefaultDatastoreNames.ENTITY_STORE ) );
    associationCache = new Cache<SerializableKey>( cacheManager.getCache( DefaultDatastoreNames.ASSOCIATION_STORE ) );
View Full Code Here

        return findDefaultCacheManager(confName, configFileURL);
    }
   
    private static CacheManager findDefaultCacheManager(String confName, URL configFileURL) {
        try {
            Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL);
            conf.setName(confName);
            if ("java.io.tmpdir".equals(conf.getDiskStoreConfiguration().getOriginalPath())) {
                String path = conf.getDiskStoreConfiguration().getPath() + File.separator
                    + confName;
                conf.getDiskStoreConfiguration().setPath(path);
            }
            return createCacheManager(conf);
        } catch (Throwable t) {
            return null;
        }
View Full Code Here

            }
        } catch (IOException e) {
            // Do nothing
        }
        try {
            Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL);
            /*
            String perBus = (String)bus.getProperty("ws-security.cachemanager.per.bus");
            if (perBus == null) {
                perBus = "true";
            }
            if (Boolean.parseBoolean(perBus)) {
            */
            conf.setName(busId);
            if ("java.io.tmpdir".equals(conf.getDiskStoreConfiguration().getOriginalPath())) {
                String path = conf.getDiskStoreConfiguration().getPath() + File.separator
                    + busId;
                conf.getDiskStoreConfiguration().setPath(path);
            }
            return CacheManager.create(conf);
        } catch (Throwable t) {
            return null;
        }
View Full Code Here

    if (UNIQUE_TEST_NAMES.putIfAbsent(uniqueName, uniqueName) != null) {
      throw new OpenGammaRuntimeException("CacheManager has already been created with unique name: " + uniqueName);
    }
    try {
      InputStream configStream = getTestEhCacheConfig();
      Configuration config = ConfigurationFactory.parseConfiguration(configStream);
      config.setName(uniqueName);
      config.setUpdateCheck(false);
      return CacheManager.newInstance(config);
    } catch (CacheException ex) {
      throw new OpenGammaRuntimeException("Unable to create CacheManager", ex);
    }
  }
View Full Code Here

      System.err.println("Using ehcache.config from system property: " + ehcacheConfigFile);
    } else {
      System.err.println("Using default ehcache.config file name: " + ehcacheConfigFile);
    }
    try (InputStream resource = EHCacheUtils.class.getResourceAsStream(ehcacheConfigFile)) {
      Configuration config = ConfigurationFactory.parseConfiguration(resource);
      config.setUpdateCheck(false);
      return config;
    } catch (IOException ex) {
      throw new OpenGammaRuntimeException("Unable to read ehcache file", ex);
    }
  }
View Full Code Here

      throw new OpenGammaRuntimeException("", e);
    }
    _socket.setPortNumber(_serverSocket.getPortNumber());

    RemoteCacheClient client = new RemoteCacheClient(_socket);
    Configuration configuration = new Configuration();
    CacheConfiguration cacheConfig = new CacheConfiguration();
    cacheConfig.setMaxElementsInMemory(cacheSize);
    configuration.setDefaultCacheConfiguration(cacheConfig);
    _cacheSource = new RemoteViewComputationCacheSource(client, new DefaultFudgeMessageStoreFactory(
        new InMemoryBinaryDataStoreFactory(), s_fudgeContext), _cacheManager);
  }
View Full Code Here

TOP

Related Classes of net.sf.ehcache.config.Configuration

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.