/** * @return Started flag. */ public boolean started() { if (startLatch.getCount() != 0) return false; GridCachePreloader prldr = preloader(); return prldr == null || prldr.startFuture().isDone(); }
/** * @throws IgniteCheckedException If failed to wait. */ public void awaitStarted() throws IgniteCheckedException { U.await(startLatch); GridCachePreloader prldr = preloader(); if (prldr != null) prldr.startFuture().get(); }
/** * Initializes this future. */ public void init() { assert cctx.preloader().startFuture().isDone(); map(keys, Collections.<ClusterNode>emptyList()); markInitialized(); }
/** * @param opCtx Cache operation context to guard. * @return Previous operation context set on this thread. */ @Nullable public CacheOperationContext enter(@Nullable CacheOperationContext opCtx) { try { GridCacheAdapter<K, V> cache = ctx.cache(); GridCachePreloader preldr = cache != null ? cache.preloader() : null; if (preldr == null) throw new IllegalStateException(new CacheStoppedException(ctx.name())); preldr.startFuture().get(); } catch (IgniteCheckedException e) { throw new IgniteException("Failed to wait for cache preloader start [cacheName=" + ctx.name() + "]", e); } onEnter(opCtx); Lock lock = rwLock.readLock(); lock.lock(); checkState(true, true); // Must unlock in case of unexpected errors to avoid // deadlocks during kernal stop. try { return setOperationContextPerCall(opCtx); } catch (Throwable e) { lock.unlock(); throw e; } }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected void onKernalStart0() throws IgniteCheckedException { dataCachePrj = igfsCtx.kernalContext().cache().getOrStartCache(dataCacheName); assert dataCachePrj != null; dataCache = (IgniteInternalCache)dataCachePrj; AffinityKeyMapper mapper = igfsCtx.kernalContext().cache() .internalCache(dataCacheName).configuration().getAffinityMapper(); grpSize = mapper instanceof IgfsGroupDataBlocksKeyMapper ? ((IgfsGroupDataBlocksKeyMapper)mapper).getGroupSize() : 1; grpBlockSize = igfsCtx.configuration().getBlockSize() * (long)grpSize; assert grpBlockSize != 0; igfsCtx.kernalContext().cache().internalCache(dataCacheName).preloader() .startFuture().listen(new CI1<IgniteInternalFuture<Object>>() { @Override public void apply(IgniteInternalFuture<Object> f) { dataCacheStartLatch.countDown(); } }); new Thread(delWorker).start(); }
/** {@inheritDoc} */ @SuppressWarnings("RedundantCast") @Override protected void onKernalStart0() throws IgniteCheckedException { metaCache = igfsCtx.kernalContext().cache().getOrStartCache(metaCacheName); assert metaCache != null; igfsCtx.kernalContext().cache().internalCache(metaCacheName).preloader().startFuture() .listen(new CI1<IgniteInternalFuture<Object>>() { @Override public void apply(IgniteInternalFuture<Object> f) { metaCacheStartLatch.countDown(); } }); id2InfoPrj = (IgniteInternalCache<IgniteUuid, IgfsEntryInfo>)metaCache.<IgniteUuid, IgfsEntryInfo>cache(); locNode = igfsCtx.kernalContext().discovery().localNode(); // Start background delete worker. if (!client) { delWorker = new IgfsDeleteWorker(igfsCtx); delWorker.start(); } }
/** * @return Started flag. */ public boolean started() { if (startLatch.getCount() != 0) return false; GridCachePreloader prldr = preloader(); return prldr == null || prldr.startFuture().isDone(); }
/** * Initializes this future. */ public void init() { assert cctx.preloader().startFuture().isDone(); map(keys, Collections.<ClusterNode>emptyList()); markInitialized(); }
/** * @throws IgniteCheckedException If failed to wait. */ public void awaitStarted() throws IgniteCheckedException { U.await(startLatch); GridCachePreloader prldr = preloader(); if (prldr != null) prldr.startFuture().get(); }
/** * @param opCtx Cache operation context to guard. * @return Previous operation context set on this thread. */ @Nullable public CacheOperationContext enter(@Nullable CacheOperationContext opCtx) { try { GridCacheAdapter<K, V> cache = ctx.cache(); GridCachePreloader preldr = cache != null ? cache.preloader() : null; if (preldr == null) throw new IllegalStateException(new CacheStoppedException(ctx.name())); preldr.startFuture().get(); } catch (IgniteCheckedException e) { throw new IgniteException("Failed to wait for cache preloader start [cacheName=" + ctx.name() + "]", e); } onEnter(opCtx); Lock lock = rwLock.readLock(); lock.lock(); checkState(true, true); // Must unlock in case of unexpected errors to avoid // deadlocks during kernal stop. try { return setOperationContextPerCall(opCtx); } catch (Throwable e) { lock.unlock(); throw e; } }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected void onKernalStart0() throws IgniteCheckedException { dataCachePrj = igfsCtx.kernalContext().cache().getOrStartCache(dataCacheName); assert dataCachePrj != null; dataCache = (IgniteInternalCache)dataCachePrj; AffinityKeyMapper mapper = igfsCtx.kernalContext().cache() .internalCache(dataCacheName).configuration().getAffinityMapper(); grpSize = mapper instanceof IgfsGroupDataBlocksKeyMapper ? ((IgfsGroupDataBlocksKeyMapper)mapper).getGroupSize() : 1; grpBlockSize = igfsCtx.configuration().getBlockSize() * (long)grpSize; assert grpBlockSize != 0; igfsCtx.kernalContext().cache().internalCache(dataCacheName).preloader() .startFuture().listen(new CI1<IgniteInternalFuture<Object>>() { @Override public void apply(IgniteInternalFuture<Object> f) { dataCacheStartLatch.countDown(); } }); new Thread(delWorker).start(); }
/** {@inheritDoc} */ @SuppressWarnings("RedundantCast") @Override protected void onKernalStart0() throws IgniteCheckedException { metaCache = igfsCtx.kernalContext().cache().getOrStartCache(metaCacheName); assert metaCache != null; igfsCtx.kernalContext().cache().internalCache(metaCacheName).preloader().startFuture() .listen(new CI1<IgniteInternalFuture<Object>>() { @Override public void apply(IgniteInternalFuture<Object> f) { metaCacheStartLatch.countDown(); } }); id2InfoPrj = (IgniteInternalCache<IgniteUuid, IgfsEntryInfo>)metaCache.<IgniteUuid, IgfsEntryInfo>cache(); locNode = igfsCtx.kernalContext().discovery().localNode(); // Start background delete worker. if (!client) { delWorker = new IgfsDeleteWorker(igfsCtx); delWorker.start(); } }