@Test public void testConfigurationCannotBeSharedAcrossRunningCacheManagers() { Configuration configuration = new Configuration(); configuration.setupFor(mock(CacheManager.class), "one"); try { configuration.setupFor(mock(CacheManager.class), "two"); } catch (IllegalStateException e) { assertThat(e.getMessage(), containsString("share a Configuration")); } }
public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { return cfg; } final Collection<ConfigError> errors = validate(); if (!errors.isEmpty()) { throw new InvalidConfigurationException(errors); } cfg = new Configuration.RuntimeCfg(cacheManager, fallbackName); return cfg; }
Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { return cfg; } final Collection<ConfigError> errors = validate(); if (!errors.isEmpty()) { throw new InvalidConfigurationException(errors); } cfg = new Configuration.RuntimeCfg(cacheManager, fallbackName); return cfg; } }
Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { return cfg; } final Collection<ConfigError> errors = validate(); if (!errors.isEmpty()) { throw new InvalidConfigurationException(errors); } cfg = new Configuration.RuntimeCfg(cacheManager, fallbackName); return cfg; } Configuration(); }
Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { return cfg; } final Collection<ConfigError> errors = validate(); if (!errors.isEmpty()) { throw new InvalidConfigurationException(errors); } cfg = new Configuration.RuntimeCfg(cacheManager, fallbackName); return cfg; } Configuration(); RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName); Collection<ConfigError> validate(); boolean isMaxBytesLocalDiskSet(); boolean isMaxBytesLocalOffHeapSet(); boolean isMaxBytesLocalHeapSet(); final Configuration name(String name); final void setName(String name); final String getName(); final Configuration updateCheck(boolean updateCheck); final void setUpdateCheck(boolean updateCheck); final boolean getUpdateCheck(); final Configuration defaultTransactionTimeoutInSeconds(int defaultTransactionTimeoutInSeconds); final void setDefaultTransactionTimeoutInSeconds(int defaultTransactionTimeoutInSeconds); final int getDefaultTransactionTimeoutInSeconds(); final Configuration monitoring(Monitoring monitoring); final void setMonitoring(String monitoring); final Monitoring getMonitoring(); final Configuration dynamicConfig(boolean dynamicConfig); final void setDynamicConfig(boolean dynamicConfig); final boolean getDynamicConfig(); long getMaxBytesLocalHeap(); void setMaxBytesLocalHeap(final String maxBytesOnHeap); String getMaxBytesLocalHeapAsString(); void setMaxBytesLocalHeap(final Long maxBytesOnHeap); Configuration maxBytesLocalHeap(final long amount, final MemoryUnit memoryUnit); long getMaxBytesLocalOffHeap(); void setMaxBytesLocalOffHeap(final String maxBytesOffHeap); String getMaxBytesLocalOffHeapAsString(); long getTotalConfiguredOffheap(); void setMaxBytesLocalOffHeap(final Long maxBytesOffHeap); Configuration maxBytesLocalOffHeap(final long amount, final MemoryUnit memoryUnit); long getMaxBytesLocalDisk(); void setMaxBytesLocalDisk(final String maxBytesOnDisk); String getMaxBytesLocalDiskAsString(); void setMaxBytesLocalDisk(final Long maxBytesOnDisk); Configuration maxBytesLocalDisk(final long amount, final MemoryUnit memoryUnit); final Configuration diskStore(DiskStoreConfiguration diskStoreConfigurationParameter); final void addDiskStore(DiskStoreConfiguration diskStoreConfigurationParameter); final Configuration sizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicyConfiguration); final void addSizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicy); final Configuration transactionManagerLookup(FactoryConfiguration transactionManagerLookupParameter); final void addTransactionManagerLookup(FactoryConfiguration transactionManagerLookupParameter); final Configuration cacheManagerEventListenerFactory(FactoryConfiguration cacheManagerEventListenerFactoryConfiguration); final void addCacheManagerEventListenerFactory(FactoryConfiguration cacheManagerEventListenerFactoryConfiguration); final Configuration cacheManagerPeerProviderFactory(FactoryConfiguration factory); final void addCacheManagerPeerProviderFactory(FactoryConfiguration factory); final Configuration cacheManagerPeerListenerFactory(FactoryConfiguration factory); final void addCacheManagerPeerListenerFactory(FactoryConfiguration factory); final Configuration terracotta(TerracottaClientConfiguration terracottaConfiguration); final void addTerracottaConfig(TerracottaClientConfiguration terracottaConfiguration); final Configuration managementRESTService(ManagementRESTServiceConfiguration cfg); final void addManagementRESTService(ManagementRESTServiceConfiguration managementRESTServiceConfiguration); final Configuration defaultCache(CacheConfiguration defaultCacheConfiguration); final void addDefaultCache(CacheConfiguration defaultCacheConfiguration); final Configuration cache(CacheConfiguration cacheConfiguration); final void addCache(CacheConfiguration cacheConfiguration); final Set<String> getCacheConfigurationsKeySet(); final CacheConfiguration getDefaultCacheConfiguration(); final void setDefaultCacheConfiguration(CacheConfiguration defaultCacheConfiguration); final DiskStoreConfiguration getDiskStoreConfiguration(); final SizeOfPolicyConfiguration getSizeOfPolicyConfiguration(); final FactoryConfiguration getTransactionManagerLookupConfiguration(); final List<FactoryConfiguration> getCacheManagerPeerProviderFactoryConfiguration(); final List<FactoryConfiguration> getCacheManagerPeerListenerFactoryConfigurations(); final ManagementRESTServiceConfiguration getManagementRESTService(); final FactoryConfiguration getCacheManagerEventListenerFactoryConfiguration(); final TerracottaClientConfiguration getTerracottaConfiguration(); final Map<String, CacheConfiguration> getCacheConfigurations(); final Configuration source(ConfigurationSource configurationSource); final void setSource(ConfigurationSource configurationSource); final ConfigurationSource getConfigurationSource(); boolean addPropertyChangeListener(final PropertyChangeListener listener); boolean removePropertyChangeListener(final PropertyChangeListener listener); void cleanup(); }
Configuration { public RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName) throws InvalidConfigurationException { if (cfg != null) { return cfg; } final Collection<ConfigError> errors = validate(); if (!errors.isEmpty()) { throw new InvalidConfigurationException(errors); } cfg = new Configuration.RuntimeCfg(cacheManager, fallbackName); return cfg; } Configuration(); RuntimeCfg setupFor(final CacheManager cacheManager, final String fallbackName); Collection<ConfigError> validate(); boolean isMaxBytesLocalDiskSet(); boolean isMaxBytesLocalOffHeapSet(); boolean isMaxBytesLocalHeapSet(); final Configuration name(String name); final void setName(String name); final String getName(); final Configuration updateCheck(boolean updateCheck); final void setUpdateCheck(boolean updateCheck); final boolean getUpdateCheck(); final Configuration defaultTransactionTimeoutInSeconds(int defaultTransactionTimeoutInSeconds); final void setDefaultTransactionTimeoutInSeconds(int defaultTransactionTimeoutInSeconds); final int getDefaultTransactionTimeoutInSeconds(); final Configuration monitoring(Monitoring monitoring); final void setMonitoring(String monitoring); final Monitoring getMonitoring(); final Configuration dynamicConfig(boolean dynamicConfig); final void setDynamicConfig(boolean dynamicConfig); final boolean getDynamicConfig(); long getMaxBytesLocalHeap(); void setMaxBytesLocalHeap(final String maxBytesOnHeap); String getMaxBytesLocalHeapAsString(); void setMaxBytesLocalHeap(final Long maxBytesOnHeap); Configuration maxBytesLocalHeap(final long amount, final MemoryUnit memoryUnit); long getMaxBytesLocalOffHeap(); void setMaxBytesLocalOffHeap(final String maxBytesOffHeap); String getMaxBytesLocalOffHeapAsString(); long getTotalConfiguredOffheap(); void setMaxBytesLocalOffHeap(final Long maxBytesOffHeap); Configuration maxBytesLocalOffHeap(final long amount, final MemoryUnit memoryUnit); long getMaxBytesLocalDisk(); void setMaxBytesLocalDisk(final String maxBytesOnDisk); String getMaxBytesLocalDiskAsString(); void setMaxBytesLocalDisk(final Long maxBytesOnDisk); Configuration maxBytesLocalDisk(final long amount, final MemoryUnit memoryUnit); final Configuration diskStore(DiskStoreConfiguration diskStoreConfigurationParameter); final void addDiskStore(DiskStoreConfiguration diskStoreConfigurationParameter); final Configuration sizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicyConfiguration); final void addSizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicy); final Configuration transactionManagerLookup(FactoryConfiguration transactionManagerLookupParameter); final void addTransactionManagerLookup(FactoryConfiguration transactionManagerLookupParameter); final Configuration cacheManagerEventListenerFactory(FactoryConfiguration cacheManagerEventListenerFactoryConfiguration); final void addCacheManagerEventListenerFactory(FactoryConfiguration cacheManagerEventListenerFactoryConfiguration); final Configuration cacheManagerPeerProviderFactory(FactoryConfiguration factory); final void addCacheManagerPeerProviderFactory(FactoryConfiguration factory); final Configuration cacheManagerPeerListenerFactory(FactoryConfiguration factory); final void addCacheManagerPeerListenerFactory(FactoryConfiguration factory); final Configuration terracotta(TerracottaClientConfiguration terracottaConfiguration); final void addTerracottaConfig(TerracottaClientConfiguration terracottaConfiguration); final Configuration managementRESTService(ManagementRESTServiceConfiguration cfg); final void addManagementRESTService(ManagementRESTServiceConfiguration managementRESTServiceConfiguration); final Configuration defaultCache(CacheConfiguration defaultCacheConfiguration); final void addDefaultCache(CacheConfiguration defaultCacheConfiguration); final Configuration cache(CacheConfiguration cacheConfiguration); final void addCache(CacheConfiguration cacheConfiguration); final Set<String> getCacheConfigurationsKeySet(); final CacheConfiguration getDefaultCacheConfiguration(); final void setDefaultCacheConfiguration(CacheConfiguration defaultCacheConfiguration); final DiskStoreConfiguration getDiskStoreConfiguration(); final SizeOfPolicyConfiguration getSizeOfPolicyConfiguration(); final FactoryConfiguration getTransactionManagerLookupConfiguration(); final List<FactoryConfiguration> getCacheManagerPeerProviderFactoryConfiguration(); final List<FactoryConfiguration> getCacheManagerPeerListenerFactoryConfigurations(); final ManagementRESTServiceConfiguration getManagementRESTService(); final FactoryConfiguration getCacheManagerEventListenerFactoryConfiguration(); final TerracottaClientConfiguration getTerracottaConfiguration(); final Map<String, CacheConfiguration> getCacheConfigurations(); final Configuration source(ConfigurationSource configurationSource); final void setSource(ConfigurationSource configurationSource); final ConfigurationSource getConfigurationSource(); boolean addPropertyChangeListener(final PropertyChangeListener listener); boolean removePropertyChangeListener(final PropertyChangeListener listener); void cleanup(); static final boolean DEFAULT_DYNAMIC_CONFIG; static final boolean DEFAULT_UPDATE_CHECK; static final int DEFAULT_TRANSACTION_TIMEOUT; static final long DEFAULT_MAX_BYTES_ON_HEAP; static final long DEFAULT_MAX_BYTES_OFF_HEAP; static final long DEFAULT_MAX_BYTES_ON_DISK; static final Monitoring DEFAULT_MONITORING; static final SizeOfPolicyConfiguration DEFAULT_SIZEOF_POLICY_CONFIGURATION; static final FactoryConfiguration DEFAULT_TRANSACTION_MANAGER_LOOKUP_CONFIG; }