/** * @return If current thread belongs to client. */ private boolean clientThread() { assert Thread.currentThread() instanceof IgniteThread; return ((IgniteThread)Thread.currentThread()).getIgniteInstanceName().contains("client"); }
/** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { field = (String)in.readObject(); Thread cur = Thread.currentThread(); // Decrement readCnt and fail only on node with index 1. if (cur instanceof IgniteThread && ((IgniteThread)cur).getIgniteInstanceName().endsWith("1") && readCnt.decrementAndGet() <= 0) throw new IOException("Class can not be unmarshalled."); } }
/** * Gets a name of the grid from thread local config, which is owner of current thread. * * @return Grid instance related to current thread * @throws IllegalArgumentException Thrown to indicate, that current thread is not an {@link IgniteThread}. */ public static IgniteKernal localIgnite() throws IllegalArgumentException { String name = U.getCurrentIgniteName(); if (U.isCurrentIgniteNameSet(name)) return gridx(name); else if (Thread.currentThread() instanceof IgniteThread) return gridx(((IgniteThread)Thread.currentThread()).getIgniteInstanceName()); else throw new IllegalArgumentException("Ignite instance name thread local must be set or" + " this method should be accessed under " + IgniteThread.class.getName()); }
/** * Gets a name of the grid from thread local config, which is owner of current thread. * * @return Grid instance related to current thread * @throws IllegalArgumentException Thrown to indicate, that current thread is not an {@link IgniteThread}. */ public static IgniteKernal localIgnite() throws IllegalArgumentException { String name = U.getCurrentIgniteName(); if (U.isCurrentIgniteNameSet(name)) return gridx(name); else if (Thread.currentThread() instanceof IgniteThread) return gridx(((IgniteThread)Thread.currentThread()).getIgniteInstanceName()); else throw new IllegalArgumentException("Ignite instance name thread local must be set or" + " this method should be accessed under " + IgniteThread.class.getName()); }