/** * @return Grid instance. */ public IgniteEx grid() { return ctx.grid(); }
/** {@inheritDoc} */ @Override public <T> T unwrap(Class<T> cls) { if (cls.isAssignableFrom(Ignite.class)) return (T)cctx.kernalContext().grid(); else if (cls.isAssignableFrom(GridCacheContext.class)) return (T)cctx; else if (cls.isAssignableFrom(getClass())) return cls.cast(this); throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls); }
/** * @param ctx Kernal context. */ @SuppressWarnings("deprecation") public CacheObjectBinaryProcessorImpl(GridKernalContext ctx) { super(ctx); marsh = ctx.grid().configuration().getMarshaller(); }
/** {@inheritDoc} */ @Override public final Ignite ignite() { assert ctx != null; guard(); try { return ctx.grid(); } finally { unguard(); } }
/** * Constructor. * * @param platformCtx Context. */ public PlatformTransactions(PlatformContext platformCtx) { super(platformCtx); txs = platformCtx.kernalContext().grid().transactions(); }
/** * Constructor. * * @param platformCtx Context. * @param lbl Label. */ public PlatformTransactions(PlatformContext platformCtx, String lbl) { super(platformCtx); txs = platformCtx.kernalContext().grid().transactions().withLabel(lbl); }
/** * Convert object to binary form. * * @param src Source object. * @return Result. */ private Object toBinary(Object src) { return platformCtx.kernalContext().grid().binary().toBinary(src); }
/** {@inheritDoc} */ @Override public PlatformContext context() { throw new IgniteException("Platforms are not available [nodeId=" + ctx.grid().localNode().id() + "] " + "(Use Apache.Ignite.Core.Ignition.Start() or Apache.Ignite.exe to start Ignite.NET nodes; " + "ignite::Ignition::Start() or ignite.exe to start Ignite C++ nodes)."); }
/** {@inheritDoc} */ @Override public ClientResponse process(ClientConnectionContext ctx) { ctx.kernalContext().grid().getOrCreateCache(cacheName); return super.process(ctx); } }
/** * Gets the cache for current cache id, ignoring any flags. * * @param ctx Kernal context. * @return Cache. */ protected IgniteCache rawCache(ClientConnectionContext ctx) { DynamicCacheDescriptor cacheDesc = cacheDescriptor(ctx); String cacheName = cacheDesc.cacheName(); return ctx.kernalContext().grid().cache(cacheName); }
/** * Filter server nodes by consistent IDs. * * @param consistentIds Collection of consistent IDs to add. * @throws IllegalStateException In case of some consistent ID not found in nodes collection. */ private Collection<BaselineNode> filterServerNodesByConsId(List<Object> consistentIds) { return filterNodesByConsId(ctx.grid().cluster().forServers().nodes(), consistentIds); } }
/** {@inheritDoc} */ @Override public ClientResponse process(ClientConnectionContext ctx) { try { ctx.kernalContext().grid().createCache(cacheCfg); } catch (CacheExistsException e) { throw new IgniteClientException(ClientStatus.CACHE_EXISTS, e.getMessage()); } return super.process(ctx); } }
/** {@inheritDoc} */ @Override public void stopNodes(Collection<UUID> ids) throws IgniteException { guard(); try { ctx.grid().compute(forNodeIds(ids)).execute(IgniteKillTask.class, false); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public ClientResponse process(ClientConnectionContext ctx) { try { ctx.kernalContext().grid().createCache(cacheName); } catch (CacheExistsException e) { throw new IgniteClientException(ClientStatus.CACHE_EXISTS, e.getMessage()); } return super.process(ctx); } }
/** {@inheritDoc} */ @Override public ClientResponse process(ClientConnectionContext ctx) { try { ctx.kernalContext().grid().getOrCreateCache(cacheCfg); } catch (CacheExistsException e) { throw new IgniteClientException(ClientStatus.CACHE_EXISTS, e.getMessage()); } return super.process(ctx); } }
/** {@inheritDoc} */ @Override public void restartNodes(Collection<UUID> ids) throws IgniteException { guard(); try { ctx.grid().compute(forNodeIds(ids)).execute(IgniteKillTask.class, true); } finally { unguard(); } }
/** * @param loc Enforce local. * @return Local node cluster group. */ private ClusterGroup projection(boolean loc) { GridCacheContext<K, V> ctx = getContextSafe(); if (loc || ctx.isLocal() || ctx.isReplicatedAffinityNode()) return ctx.kernalContext().grid().cluster().forLocal(); if (ctx.isReplicated()) return ctx.kernalContext().grid().cluster().forDataNodes(cacheName).forRandom(); return null; }
@Override public Object call() throws Exception { Long init = req.initial(); Long delta = req.delta(); boolean decr = req.command() == ATOMIC_DECREMENT; String key = (String)req.key(); IgniteAtomicLong l = ctx.grid().atomicLong(key, init != null ? init : 0, true); return l.addAndGet(decr ? -delta : delta); } }, false);
/** * Collect baseline topology command result. * * @return Baseline descriptor. */ private GridBaselineCommandResponse currentState() { IgniteClusterEx cluster = ctx.grid().cluster(); Collection<? extends BaselineNode> srvrs = cluster.forServers().nodes(); return new GridBaselineCommandResponse(cluster.active(), cluster.topologyVersion(), currentBaseLine(), srvrs); }
/** * Gets the data cache instance for this IGFS instance. * * @param igfs The IGFS unstance. * @return The data cache. */ protected static GridCacheAdapter<IgfsBlockKey, byte[]> getDataCache(IgniteFileSystem igfs) { String dataCacheName = igfs.configuration().getDataCacheConfiguration().getName(); IgniteEx igniteEx = ((IgfsEx)igfs).context().kernalContext().grid(); return ((IgniteKernal)igniteEx).internalCache(dataCacheName); }