Package net.sf.ehcache.config

Examples of net.sf.ehcache.config.FactoryConfiguration


  @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<SerializableEntityKey>( cacheManager.getCache( CacheNames.ENTITY_CACHE ) );
View Full Code Here


  @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<SerializableEntityKey>( cacheManager.getCache( DefaultDatastoreNames.ENTITY_STORE ) );
View Full Code Here

      url = this.getClass().getResource( "/org/hibernate/ogm/datastore/ehcache/default-ehcache.xml" );
    }
    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

  @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 ) );
View Full Code Here

    try {

      CoreLogger.LOGGER.info("In cluster mode.");
      inputStream = new ClassPathResource("ehcache-dist.xml").getInputStream();
      cacheManagerConfig = ConfigurationFactory.parseConfiguration(inputStream);
      FactoryConfiguration peerProviderConfig = new FactoryConfiguration();
      peerProviderConfig.setClass(RMICacheManagerPeerProviderFactory.class.getName());
      List<String> replicatedCacheNames = getReplicatedCacheNames(cacheManagerConfig);
      Pair<NetworkUtils.IPPortPair, String> properties = createManualDiscoveryCacheProperties(replicatedCacheNames);
      NetworkUtils.IPPortPair currentListener = properties.getFirst();
      String peerProperty = properties.getSecond();
      peerProviderConfig.setProperties(peerProperty);
      cacheManagerConfig.addCacheManagerPeerProviderFactory(peerProviderConfig);
      System.setProperty("java.rmi.server.hostname", currentListener.getFormattedIP());
      FactoryConfiguration peerListenerConfig = new FactoryConfiguration();
      peerListenerConfig.setClass(RMICacheManagerPeerListenerFactory.class.getName());
      String peerListenerProperty = String.format("hostName=%s, port=%d, socketTimeoutMillis=1000",
          currentListener.getFormattedIP(), currentListener.getPort());
      peerListenerConfig.setProperties(peerListenerProperty);
      cacheManagerConfig.addCacheManagerPeerListenerFactory(peerListenerConfig);
      CoreLogger.LOGGER.info("clusterURLs:{}", peerListenerProperty);
      cacheManagerConfig.setName("TestCluster");
      CacheManager mgr = CacheManager.create(cacheManagerConfig);
      cacheManager.setCacheManager(mgr);
View Full Code Here

    return config.isClustered();
  }

  private Pair<FactoryConfiguration, NetworkUtils.IPPortPair> createRMICacheManagerPeerProviderFactory
      (Configuration cacheManagerConfig) {
    FactoryConfiguration peerProviderConfig = new FactoryConfiguration();
    peerProviderConfig.setClass(RMICacheManagerPeerProviderFactory.class.getName());

    Pair<NetworkUtils.IPPortPair, String> properties;
    if (StringUtils.equals(getClusterMode(), "advanced")) {
      CoreLogger.LOGGER.info("In cluster - advanced mode.");
      properties = createManualDiscoveryCacheProperties(getReplicatedCacheNames(cacheManagerConfig));
    } else {
      CoreLogger.LOGGER.info("In cluster - easy mode.");
      properties = createAutoDiscoveryCacheProperties();
    }

    NetworkUtils.IPPortPair currentListener = properties.getFirst();
    System.setProperty("java.rmi.server.hostname", currentListener.getFormattedIP());

    String peers = properties.getSecond();
    peerProviderConfig.setProperties(peers);
    CoreLogger.LOGGER.info("peer provider is set as {}", peers);
    return Pair.of(peerProviderConfig, currentListener);
  }
View Full Code Here

  protected String getClusterMode() {
    return config.getClusterProperties().getProperty(ClusterConstants.PROP_CLUSTER_MODE, "advanced");
  }

  private FactoryConfiguration createPearListenerFactory(String ip, int port) {
    FactoryConfiguration peerListenerConfig = new FactoryConfiguration();
    peerListenerConfig.setClass(RMICacheManagerPeerListenerFactory.class.getName());
    peerListenerConfig.setProperties(String.format("hostName=%s, port=%d, socketTimeoutMillis=3000", ip, port));
    CoreLogger.LOGGER.info("peer listener is set as {}:{}", ip, port);
    return peerListenerConfig;
  }
View Full Code Here

  @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 ) );
View Full Code Here

      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

  @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 ) );
View Full Code Here

TOP

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

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.