Search in sources :

Example 1 with CacheInfo

use of org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData.CacheInfo in project ignite by apache.

the class GridCacheProcessor method start.

/**
 * {@inheritDoc}
 */
@SuppressWarnings({ "unchecked" })
@Override
public void start() 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();
    Collection<CacheStoreSessionListener> sessionListeners = CU.startStoreSessionListeners(ctx, ctx.config().getCacheStoreSessionListenerFactories());
    sharedCtx = createSharedContext(ctx, sessionListeners);
    transactions = new IgniteTransactionsImpl(sharedCtx);
    // Start shared managers.
    for (GridCacheSharedManager mgr : sharedCtx.managers()) mgr.start(sharedCtx);
    if (!ctx.isDaemon()) {
        Map<String, CacheInfo> caches = new HashMap<>();
        Map<String, CacheInfo> templates = new HashMap<>();
        addCacheOnJoinFromConfig(caches, templates);
        CacheJoinNodeDiscoveryData discoData = new CacheJoinNodeDiscoveryData(IgniteUuid.randomUuid(), caches, templates, startAllCachesOnClientStart());
        cachesInfo.onStart(discoData);
        if (log.isDebugEnabled())
            log.debug("Started cache processor.");
    }
    ctx.state().cacheProcessorStarted();
    ctx.authentication().cacheProcessorStarted();
}
Also used : IgniteTransactionsImpl(org.apache.ignite.internal.processors.cache.transactions.IgniteTransactionsImpl) IdentityHashMap(java.util.IdentityHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) DeploymentMode(org.apache.ignite.configuration.DeploymentMode) CacheStoreSessionListener(org.apache.ignite.cache.store.CacheStoreSessionListener) CacheInfo(org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData.CacheInfo)

Example 2 with CacheInfo

use of org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData.CacheInfo in project ignite by apache.

the class GridCacheProcessor method addCacheOnJoin.

/**
 * @param cfg Cache configuration.
 * @param sql SQL flag.
 * @param caches Caches map.
 * @param templates Templates map.
 * @throws IgniteCheckedException If failed.
 */
private void addCacheOnJoin(CacheConfiguration<?, ?> cfg, boolean sql, Map<String, CacheInfo> caches, Map<String, CacheInfo> templates) throws IgniteCheckedException {
    String cacheName = cfg.getName();
    CU.validateCacheName(cacheName);
    cloneCheckSerializable(cfg);
    CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(cfg);
    // Initialize defaults.
    initialize(cfg, cacheObjCtx);
    StoredCacheData cacheData = new StoredCacheData(cfg);
    cacheData.sql(sql);
    boolean template = cacheName.endsWith("*");
    if (!template) {
        if (caches.containsKey(cacheName)) {
            throw new IgniteCheckedException("Duplicate cache name found (check configuration and " + "assign unique name to each cache): " + cacheName);
        }
        CacheType cacheType = cacheType(cacheName);
        if (cacheType != CacheType.USER && cfg.getDataRegionName() == null)
            cfg.setDataRegionName(sharedCtx.database().systemDateRegionName());
        if (!cacheType.userCache())
            stopSeq.addLast(cacheName);
        else
            stopSeq.addFirst(cacheName);
        caches.put(cacheName, new CacheJoinNodeDiscoveryData.CacheInfo(cacheData, cacheType, cacheData.sql(), 0));
    } else
        templates.put(cacheName, new CacheJoinNodeDiscoveryData.CacheInfo(cacheData, CacheType.USER, false, 0));
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) CacheInfo(org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData.CacheInfo) CacheInfo(org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData.CacheInfo)

Aggregations

CacheInfo (org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData.CacheInfo)2 HashMap (java.util.HashMap)1 IdentityHashMap (java.util.IdentityHashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 CacheStoreSessionListener (org.apache.ignite.cache.store.CacheStoreSessionListener)1 DeploymentMode (org.apache.ignite.configuration.DeploymentMode)1 IgniteTransactionsImpl (org.apache.ignite.internal.processors.cache.transactions.IgniteTransactionsImpl)1