/** * This method is used to address a local {@link Ignite} instance, principally from closure. * <p> * According to contract this method has to be called only under {@link IgniteThread}. * An {@link IllegalArgumentException} will be thrown otherwise. * * @return A current {@link Ignite} instance to address from closure. * @throws IgniteIllegalStateException Thrown if grid was not properly * initialized or grid instance was stopped or was not started * @throws IllegalArgumentException Thrown if current thread is not an {@link IgniteThread}. */ public static Ignite localIgnite() throws IgniteIllegalStateException, IllegalArgumentException { return IgnitionEx.localIgnite(); }
/** * @return IgniteKernal instance. * @throws ObjectStreamException If failed. */ protected Object readResolve() throws ObjectStreamException { try { return IgnitionEx.localIgnite(); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { return IgnitionEx.localIgnite().context(); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { IgniteBiTuple<String, String> t = stash.get(); return IgnitionEx.localIgnite().cachex(t.get2()); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { return IgnitionEx.localIgnite().cluster().nodeLocalMap(); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { IgniteBiTuple<String, Object> t = stash.get(); Object ctgrR = t.get2(); IgniteLogger log = IgnitionEx.localIgnite().log(); return ctgrR != null ? log.getLogger(ctgrR) : log; } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { IgniteBiTuple<String, String> t = stash.get(); IgniteKernal grid = IgnitionEx.localIgnite(); GridCacheAdapter<K, V> cache = grid.internalCache(t.get2()); if (cache == null) throw new IllegalStateException("Failed to find cache for name: " + t.get2()); return cache.context(); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ private Object readResolve() throws ObjectStreamException { String name = stash.get(); assert name != null; try { IgniteLock lock = IgnitionEx.localIgnite().context().dataStructures().reentrantLock( name, null, false, false, false); if (lock == null) throw new IllegalStateException("Lock was not found on deserialization: " + name); return lock; } catch (IgniteCheckedException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { IgniteKernal g = IgnitionEx.localIgnite(); return ids != null ? new ClusterGroupAdapter(g.context(), subjId, ids) : new ClusterGroupAdapter(g.context(), subjId, p); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } }
/** * @return Thread-bound context. */ public static BinaryContext threadLocalContext() { BinaryContext ctx = BINARY_CTX.get().get(); if (ctx == null) { IgniteKernal ignite = IgnitionEx.localIgnite(); IgniteCacheObjectProcessor proc = ignite.context().cacheObjects(); if (proc instanceof CacheObjectBinaryProcessorImpl) return ((CacheObjectBinaryProcessorImpl)proc).binaryContext(); else throw new IgniteIllegalStateException("Ignite instance must be started with " + BinaryMarshaller.class.getName() + " [name=" + ignite.name() + ']'); } return ctx; } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ private Object readResolve() throws ObjectStreamException { try { IgniteBiTuple<GridKernalContext, String> t = stash.get(); IgniteSemaphore sem = IgnitionEx.localIgnite().context().dataStructures().semaphore( t.get2(), null, 0, false, false); if (sem == null) throw new IllegalStateException("Semaphore was not found on deserialization: " + t.get2()); return sem; } catch (IgniteCheckedException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { IgniteBiTuple<String, Object> t = stash.get(); Object ctgrR = t.get2(); IgniteLogger log = IgnitionEx.localIgnite().log(); return ctgrR != null ? log.getLogger(ctgrR) : log; } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * This method is used to address a local {@link Ignite} instance, principally from closure. * <p> * According to contract this method has to be called only under {@link IgniteThread}. * An {@link IllegalArgumentException} will be thrown otherwise. * * @return A current {@link Ignite} instance to address from closure. * @throws IgniteIllegalStateException Thrown if grid was not properly * initialized or grid instance was stopped or was not started * @throws IllegalArgumentException Thrown if current thread is not an {@link IgniteThread}. */ public static Ignite localIgnite() throws IgniteIllegalStateException, IllegalArgumentException { return IgnitionEx.localIgnite(); }
/** * @return IgniteKernal instance. * @throws ObjectStreamException If failed. */ protected Object readResolve() throws ObjectStreamException { try { return IgnitionEx.localIgnite(); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { return IgnitionEx.localIgnite().context(); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { IgniteBiTuple<String, String> t = stash.get(); return IgnitionEx.localIgnite().cachex(t.get2()); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { return IgnitionEx.localIgnite().cluster().nodeLocalMap(); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { IgniteBiTuple<String, Object> t = stash.get(); Object ctgrR = t.get2(); IgniteLogger log = IgnitionEx.localIgnite().log(); return ctgrR != null ? log.getLogger(ctgrR) : log; } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { IgniteKernal g = IgnitionEx.localIgnite(); return ids != null ? new ClusterGroupAdapter(g.context(), subjId, ids) : new ClusterGroupAdapter(g.context(), subjId, p); } catch (IllegalStateException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } }
/** * @return Thread-bound context. */ public static BinaryContext threadLocalContext() { BinaryContext ctx = GridBinaryMarshaller.BINARY_CTX.get(); if (ctx == null) { IgniteKernal ignite = IgnitionEx.localIgnite(); IgniteCacheObjectProcessor proc = ignite.context().cacheObjects(); if (proc instanceof CacheObjectBinaryProcessorImpl) return ((CacheObjectBinaryProcessorImpl)proc).binaryContext(); else throw new IgniteIllegalStateException("Ignite instance must be started with " + BinaryMarshaller.class.getName() + " [name=" + ignite.name() + ']'); } return ctx; } }