/** * @param opCtx Operation context to guard. * @return Previous operation context set on this thread. */ @Nullable public CacheOperationContext enterNoLock(@Nullable CacheOperationContext opCtx) { onEnter(opCtx); checkState(false, false); return setOperationContextPerCall(opCtx); }
/** * @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; } }
/** * @param opCtx Operation context to guard. * @return Previous operation context set on this thread. */ @Nullable public CacheOperationContext enterNoLock(@Nullable CacheOperationContext opCtx) { onEnter(opCtx); checkState(false, false); return setOperationContextPerCall(opCtx); }
/** * @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; } }