use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.
the class GlobalConfigurationManagerImpl method start.
@Start
void start() {
switch(configurationManager.getGlobalConfiguration().globalState().configurationStorage()) {
case IMMUTABLE:
this.localConfigurationManager = new ImmutableLocalConfigurationStorage();
break;
case VOLATILE:
this.localConfigurationManager = new VolatileLocalConfigurationStorage();
break;
case OVERLAY:
this.localConfigurationManager = new OverlayLocalConfigurationStorage();
break;
default:
this.localConfigurationManager = configurationManager.getGlobalConfiguration().globalState().configurationStorageClass().get();
break;
}
internalCacheRegistry.registerInternalCache(CONFIG_STATE_CACHE_NAME, new ConfigurationBuilder().build(), EnumSet.of(InternalCacheRegistry.Flag.GLOBAL));
parserRegistry = new ParserRegistry();
// Start the static caches first
Set<String> staticCacheNames = new HashSet<>(configurationManager.getDefinedCaches());
log.debugf("Starting statically defined caches: %s", staticCacheNames);
for (String cacheName : configurationManager.getDefinedCaches()) {
SecurityActions.getCache(cacheManager, cacheName);
}
localConfigurationManager.initialize(cacheManager, configurationManager, blockingManager);
// Install the global state listener
GlobalConfigurationStateListener stateCacheListener = new GlobalConfigurationStateListener(this);
getStateCache().addListener(stateCacheListener);
Map<String, Configuration> persistedCaches = localConfigurationManager.loadAllCaches();
Map<String, Configuration> persistedTemplates = localConfigurationManager.loadAllTemplates();
getStateCache().forEach((key, v) -> {
String scope = key.getScope();
if (isKnownScope(scope)) {
String name = key.getName();
CacheState state = (CacheState) v;
boolean cacheScope = CACHE_SCOPE.equals(scope);
Map<String, Configuration> map = cacheScope ? persistedCaches : persistedTemplates;
ensureClusterCompatibility(name, state, map);
CompletionStage<Void> future = cacheScope ? createCacheLocally(name, state) : createTemplateLocally(name, state);
CompletionStages.join(future);
}
});
EnumSet<CacheContainerAdmin.AdminFlag> adminFlags = EnumSet.noneOf(CacheContainerAdmin.AdminFlag.class);
persistedCaches.forEach((name, configuration) -> {
ensurePersistenceCompatibility(name, configuration);
// First create the cache locally to ensure that it's available on startup
createCacheLocally(name, null, configuration, adminFlags);
// The cache configuration was permanent, it still needs to be
CompletionStages.join(getOrCreateCache(name, configuration, adminFlags));
});
persistedTemplates.forEach((name, configuration) -> {
ensurePersistenceCompatibility(name, configuration);
// First create the cache locally to ensure that it's available on startup
createTemplateLocally(name, configuration, adminFlags);
// The template was permanent, it still needs to be
CompletionStages.join(getOrCreateTemplate(name, configuration, adminFlags));
});
}
use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.
the class BackupSenderImpl method start.
@Start
public void start() {
Transport transport = rpcManager.getTransport();
transport.checkCrossSiteAvailable();
this.cacheName = cache.wired().getName();
this.localSiteName = transport.localSiteName();
config.sites().syncBackupsStream().filter(bc -> bc.backupFailurePolicy() == BackupFailurePolicy.CUSTOM).forEach(bc -> {
String backupPolicy = bc.failurePolicyClass();
if (backupPolicy == null) {
throw new IllegalStateException("Backup policy class missing for custom failure policy!");
}
CustomFailurePolicy<Object, Object> instance = Util.getInstance(backupPolicy, globalConfig.classLoader());
instance.init(cache.wired());
siteFailurePolicy.put(bc.site(), instance);
});
}
use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.
the class ClusteredCacheBackupReceiver method start.
@Start
public void start() {
// it would be nice if we could inject bootstrap component
// this feels kind hacky but saves 3 fields in this class
ComponentRegistry cr = cache.getAdvancedCache().getComponentRegistry();
TransactionHandler txHandler = new TransactionHandler(cache, cr.getTransactionTable());
defaultHandler = new DefaultHandler(txHandler, cr.getComponent(BlockingManager.class));
}
use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.
the class DefaultIracManager method start.
@Start
public void start() {
Transport transport = rpcManager.getTransport();
transport.checkCrossSiteAvailable();
String localSiteName = transport.localSiteName();
asyncBackups.removeIf(xSiteBackup -> localSiteName.equals(xSiteBackup.getSiteName()));
if (log.isTraceEnabled()) {
String b = asyncBackups.stream().map(XSiteBackup::getSiteName).collect(Collectors.joining(", "));
log.tracef("Async remote sites found: %s", b);
}
hasClear = false;
}
use of org.infinispan.factories.annotations.Start in project infinispan by infinispan.
the class DefaultTakeOfflineManager method start.
@Start
public void start() {
String localSiteName = rpcManager.getTransport().localSiteName();
config.sites().allBackupsStream().filter(bc -> !localSiteName.equals(bc.site())).forEach(bc -> {
String siteName = bc.site();
OfflineStatus offline = new OfflineStatus(bc.takeOffline(), timeService, new Listener(siteName));
offlineStatus.put(siteName, offline);
});
}
Aggregations