use of org.apache.ignite.configuration.DeploymentMode in project ignite by apache.
the class GridCacheProcessor method start.
/** {@inheritDoc} */
@SuppressWarnings({ "unchecked" })
@Override
public void start(boolean activeOnStart) throws IgniteCheckedException {
cachesInfo = new ClusterCachesInfo(ctx);
DeploymentMode depMode = ctx.config().getDeploymentMode();
if (!F.isEmpty(ctx.config().getCacheConfiguration())) {
if (depMode != CONTINUOUS && depMode != SHARED)
U.warn(log, "Deployment mode for cache is not CONTINUOUS or SHARED " + "(it is recommended that you change deployment mode and restart): " + depMode, "Deployment mode for cache is not CONTINUOUS or SHARED.");
}
initializeInternalCacheNames();
sharedCtx = createSharedContext(ctx, CU.startStoreSessionListeners(ctx, ctx.config().getCacheStoreSessionListenerFactories()));
transactions = new IgniteTransactionsImpl(sharedCtx);
// Start shared managers.
for (GridCacheSharedManager mgr : sharedCtx.managers()) mgr.start(sharedCtx);
if (activeOnStart && !ctx.config().isDaemon()) {
Map<String, CacheJoinNodeDiscoveryData.CacheInfo> caches = new HashMap<>();
Map<String, CacheJoinNodeDiscoveryData.CacheInfo> templates = new HashMap<>();
addCacheOnJoinFromConfig(caches, templates);
addCacheOnJoinFromPersistentStore(caches, templates);
CacheJoinNodeDiscoveryData discoData = new CacheJoinNodeDiscoveryData(IgniteUuid.randomUuid(), caches, templates, startAllCachesOnClientStart());
cachesInfo.onStart(discoData);
} else {
cachesInfo.onStart(new CacheJoinNodeDiscoveryData(IgniteUuid.randomUuid(), Collections.<String, CacheJoinNodeDiscoveryData.CacheInfo>emptyMap(), Collections.<String, CacheJoinNodeDiscoveryData.CacheInfo>emptyMap(), false));
}
if (log.isDebugEnabled())
log.debug("Started cache processor.");
}
use of org.apache.ignite.configuration.DeploymentMode in project ignite by apache.
the class GridCacheProcessor method checkConsistency.
/**
* @throws IgniteCheckedException if check failed.
*/
private void checkConsistency() throws IgniteCheckedException {
for (ClusterNode n : ctx.discovery().remoteNodes()) {
if (Boolean.TRUE.equals(n.attribute(ATTR_CONSISTENCY_CHECK_SKIPPED)))
continue;
checkTransactionConfiguration(n);
checkMemoryConfiguration(n);
DeploymentMode locDepMode = ctx.config().getDeploymentMode();
DeploymentMode rmtDepMode = n.attribute(IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE);
CU.checkAttributeMismatch(log, null, n.id(), "deploymentMode", "Deployment mode", locDepMode, rmtDepMode, true);
}
}
use of org.apache.ignite.configuration.DeploymentMode in project ignite by apache.
the class GridServiceProcessor method validate.
/**
* Validates service configuration.
*
* @param c Service configuration.
* @throws IgniteException If validation failed.
*/
private void validate(ServiceConfiguration c) throws IgniteException {
IgniteConfiguration cfg = ctx.config();
DeploymentMode depMode = cfg.getDeploymentMode();
if (cfg.isPeerClassLoadingEnabled() && (depMode == PRIVATE || depMode == ISOLATED))
throw new IgniteException("Cannot deploy services in PRIVATE or ISOLATED deployment mode: " + depMode);
ensure(c.getName() != null, "getName() != null", null);
ensure(c.getTotalCount() >= 0, "getTotalCount() >= 0", c.getTotalCount());
ensure(c.getMaxPerNodeCount() >= 0, "getMaxPerNodeCount() >= 0", c.getMaxPerNodeCount());
ensure(c.getService() != null, "getService() != null", c.getService());
ensure(c.getTotalCount() > 0 || c.getMaxPerNodeCount() > 0, "c.getTotalCount() > 0 || c.getMaxPerNodeCount() > 0", null);
}
use of org.apache.ignite.configuration.DeploymentMode in project ignite by apache.
the class GridServiceProcessor method start.
/**
* {@inheritDoc}
*/
@Override
public void start() throws IgniteCheckedException {
ctx.addNodeAttribute(ATTR_SERVICES_COMPATIBILITY_MODE, srvcCompatibilitySysProp);
if (ctx.isDaemon())
return;
IgniteConfiguration cfg = ctx.config();
DeploymentMode depMode = cfg.getDeploymentMode();
if (cfg.isPeerClassLoadingEnabled() && (depMode == PRIVATE || depMode == ISOLATED) && !F.isEmpty(cfg.getServiceConfiguration()))
throw new IgniteCheckedException("Cannot deploy services in PRIVATE or ISOLATED deployment mode: " + depMode);
}
use of org.apache.ignite.configuration.DeploymentMode in project ignite by apache.
the class GridCacheProcessor method start.
/**
* {@inheritDoc}
*/
@SuppressWarnings({ "unchecked" })
@Override
public void start() throws IgniteCheckedException {
ctx.internalSubscriptionProcessor().registerMetastorageListener(recovery);
ctx.internalSubscriptionProcessor().registerDatabaseListener(recovery);
cachesInfo = new ClusterCachesInfo(ctx);
DeploymentMode depMode = ctx.config().getDeploymentMode();
if (!F.isEmpty(ctx.config().getCacheConfiguration())) {
if (depMode != CONTINUOUS && depMode != SHARED)
U.warn(log, "Deployment mode for cache is not CONTINUOUS or SHARED " + "(it is recommended that you change deployment mode and restart): " + depMode);
}
Collection<CacheStoreSessionListener> sessionListeners = CU.startStoreSessionListeners(ctx, ctx.config().getCacheStoreSessionListenerFactories());
sharedCtx = createSharedContext(ctx, sessionListeners);
locCfgMgr = new GridLocalConfigManager(this, ctx);
transactions = new IgniteTransactionsImpl(sharedCtx, null, false);
// Start shared managers.
for (GridCacheSharedManager mgr : sharedCtx.managers()) mgr.start(sharedCtx);
if (!ctx.isDaemon() && (!CU.isPersistenceEnabled(ctx.config())) || ctx.config().isClientMode()) {
CacheJoinNodeDiscoveryData data = locCfgMgr.restoreCacheConfigurations();
if (data != null)
cachesInfo.onStart(data);
}
if (log.isDebugEnabled())
log.debug("Started cache processor.");
ctx.state().cacheProcessorStarted();
ctx.systemView().registerFiltrableView(CACHE_GRP_PAGE_LIST_VIEW, CACHE_GRP_PAGE_LIST_VIEW_DESC, new CachePagesListViewWalker(), this::pagesListViewSupplier, Function.identity());
ctx.systemView().registerFiltrableView(PART_STATES_VIEW, PART_STATES_VIEW_DESC, new PartitionStateViewWalker(), this::partStatesViewSupplier, Function.identity());
ctx.systemView().registerView(CACHE_GRP_IO_VIEW, CACHE_GRP_IO_VIEW_DESC, new CacheGroupIoViewWalker(), () -> F.view(cacheGrps.values(), grp -> !grp.systemCache()), grpCtx -> {
MetricRegistry mreg = ctx.metric().registry(metricName(IoStatisticsType.CACHE_GROUP.metricGroupName(), grpCtx.cacheOrGroupName()));
return new CacheGroupIoView(grpCtx, mreg);
});
}
Aggregations