@Override public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry, Object... arguments) throws EntryProcessorException { return entry.unwrap(CacheEntry.class); } });
@Override public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry, Object... arguments) throws EntryProcessorException { return entry.unwrap(CacheEntry.class); } });
@Override public Object process(MutableEntry<Integer, String> entry, Object... args) { CacheEntry<Integer, String> verEntry = entry.unwrap(CacheEntry.class); checkVersionedEntry(verEntry); return verEntry.version(); } });
@Override public Object process(MutableEntry<Integer, String> entry, Object... args) { CacheEntry<Integer, String> verEntry = entry.unwrap(CacheEntry.class); checkVersionedEntry(verEntry); return verEntry.version(); } }));
/** {@inheritDoc} */ @Override public Void process(MutableEntry<Integer, Integer> entry, Object... args) { Ignite ignite = entry.unwrap(Ignite.class); System.out.println(Thread.currentThread().getName() + " process [node=" + ignite.name() + ", commit=" + commit + ", skipFirst=" + skipFirst + ']'); boolean skip = false; if (commit && ignite.name().equals(skipFirst)) { skipFirst = null; skip = true; } if (!skip && commit && nodeNames.contains(ignite.name())) { try { System.out.println(Thread.currentThread().getName() + " start process invoke."); assertTrue(commitStartedLatch != null && commitStartedLatch.getCount() > 0); commitStartedLatch.countDown(); assertTrue(commitFinishLatch.await(10, SECONDS)); System.out.println(Thread.currentThread().getName() + " end process invoke."); } catch (InterruptedException e) { throw new RuntimeException(e); } } else System.out.println(Thread.currentThread().getName() + " invoke set value."); entry.setValue(1); return null; } }
/** {@inheritDoc} */ @Override public T process(MutableEntry<K, V> entry, Object... arguments) throws EntryProcessorException { if (!injected) { GridCacheContext cctx = entry.unwrap(GridCacheContext.class); GridResourceProcessor rsrc = cctx.kernalContext().resource(); try { rsrc.inject(delegate, GridResourceIoc.AnnotationSet.ENTRY_PROCESSOR, cctx.name()); } catch (IgniteCheckedException e) { throw new IgniteException(e); } injected = true; } return delegate.process(entry, arguments); }
/** {@inheritDoc} */ @Override public Object process(MutableEntry entry, Object... args) throws EntryProcessorException { try { Ignite ignite = (Ignite)entry.unwrap(Ignite.class); PlatformProcessor interopProc; try { interopProc = PlatformUtils.platformProcessor(ignite); } catch (IllegalStateException ex){ throw new EntryProcessorException(ex); } interopProc.awaitStart(); return execute0(interopProc.context(), entry); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public Integer process(MutableEntry<Integer, Integer> e, Object... arguments) throws EntryProcessorException { Ignite ignite = e.unwrap(Ignite.class); assertNotNull(ignite); if (e.exists()) { Integer val = e.getValue(); assertNotNull(val); e.setValue(val + 1); assertTrue(e.exists()); assertEquals(val + 1, (int) e.getValue()); return val; } else { e.setValue(1); return -1; } }
@Override public Void process(MutableEntry<Integer, BinaryObject> e, Object... args) { BinaryObject val = e.getValue(); assertNotNull("Unexpected value: " + val, val); assertEquals(new Integer(1), val.field("val")); Ignite ignite = e.unwrap(Ignite.class); IgniteBinary binaries = ignite.binary(); BinaryObjectBuilder builder = binaries.builder(val); builder.setField("val", 2); e.setValue(builder.build()); return null; } });
@Override public Object process(MutableEntry entry, Object... arguments) throws EntryProcessorException { assertTrue(entry.getKey() instanceof BinaryObject); Object val = entry.getValue(); int valId = 0; if (val != null) { assertTrue(val instanceof BinaryObject); valId = valueOf(((BinaryObject)val).deserialize()) + 1; } Object newVal = value(valId, (DataMode)arguments[0]); Object newBinaryVal = ((Ignite)entry.unwrap(Ignite.class)).binary().toBinary(newVal); entry.setValue(newBinaryVal); return val; } };
Ignite ignite = entry.unwrap(Ignite.class);
Ignite ignite = entry.unwrap(Ignite.class);
@Override public <T> T unwrap(Class<T> clazz) { return entry.unwrap(clazz); } };
/** {@inheritDoc} */ @Override public T process(MutableEntry<K, V> entry, Object... arguments) throws EntryProcessorException { if (!injected) { GridCacheContext cctx = entry.unwrap(GridCacheContext.class); GridResourceProcessor rsrc = cctx.kernalContext().resource(); try { rsrc.inject(delegate, GridResourceIoc.AnnotationSet.ENTRY_PROCESSOR, cctx.name()); } catch (IgniteCheckedException e) { throw new IgniteException(e); } injected = true; } return delegate.process(entry, arguments); }
/** {@inheritDoc} */ @Override public Object process(MutableEntry entry, Object... args) throws EntryProcessorException { try { Ignite ignite = (Ignite)entry.unwrap(Ignite.class); PlatformProcessor interopProc; try { interopProc = PlatformUtils.platformProcessor(ignite); } catch (IllegalStateException ex){ throw new EntryProcessorException(ex); } interopProc.awaitStart(); return execute0(interopProc.context(), entry); } catch (IgniteCheckedException e) { throw U.convertException(e); } }