/** {@inheritDoc} */ @Override public void encode(BinaryRawWriterEx writer) { super.encode(writer); writer.writeObject(val); } }
/** {@inheritDoc} */ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException { BinaryRawWriterEx raw = (BinaryRawWriterEx)writer.rawWriter(); raw.writeObject(inner1); raw.writeObjectDetached(inner2); raw.writeObjectDetached(inner3); raw.writeObject(inner4); }
/** {@inheritDoc} */ @Override public void processOutStream(int type, BinaryRawWriterEx writer) throws IgniteCheckedException { if (type == OP_GET) writer.writeObject(atomicRef.get()); else super.processOutStream(type, writer); }
@Override public void applyx(BinaryRawWriterEx writer) throws IgniteCheckedException { writer.writeByte(OP_PUT_ALL); writer.writeLong(session()); writer.writeString(ses.cacheName()); writer.writeInt(entries.size()); for (Cache.Entry<? extends K, ? extends V> e : entries) { writer.writeObject(e.getKey()); writer.writeObject(e.getValue()); } } }, null);
@Override public void applyx(BinaryRawWriterEx writer) throws IgniteCheckedException { writer.writeByte(OP_PUT); writer.writeLong(session()); writer.writeString(ses.cacheName()); writer.writeObject(entry.getKey()); writer.writeObject(entry.getValue()); } }, null);
@Override public void applyx(BinaryRawWriterEx writer) throws IgniteCheckedException { writer.writeByte(OP_LOAD_ALL); writer.writeLong(session()); writer.writeString(ses.cacheName()); writer.writeInt(keys0.size()); for (Object o : keys0) writer.writeObject(o); } }, new IgniteInClosureX<BinaryRawReaderEx>() {
@Override public void applyx(BinaryRawWriterEx writer) throws IgniteCheckedException { writer.writeByte(OP_RMV_ALL); writer.writeLong(session()); writer.writeString(ses.cacheName()); writer.writeInt(keys.size()); for (Object o : keys) writer.writeObject(o); } }, null);
@Override public void applyx(BinaryRawWriterEx writer) throws IgniteCheckedException { writer.writeByte(OP_LOAD); writer.writeLong(session()); writer.writeString(ses.cacheName()); writer.writeObject(key); } }, new IgniteInClosureX<BinaryRawReaderEx>() {
/** {@inheritDoc} */ @Override public boolean apply(UUID uuid, Object m) { try (PlatformMemory mem = platformCtx.memory().allocate()) { PlatformOutputStream out = mem.output(); BinaryRawWriterEx writer = platformCtx.writer(out); writer.writeObject(uuid); writer.writeObject(m); out.synchronize(); int res = platformCtx.gateway().messagingFilterApply(hnd, mem.pointer()); return res != 0; } }
@Override public void applyx(BinaryRawWriterEx writer) throws IgniteCheckedException { writer.writeByte(OP_RMV); writer.writeLong(session()); writer.writeString(ses.cacheName()); writer.writeObject(key); } }, null);
/** {@inheritDoc} */ @Override public boolean apply(UUID uuid, Object m) { if (ptr == 0) return false; // Destroyed. try (PlatformMemory mem = ctx.memory().allocate()) { PlatformOutputStream out = mem.output(); BinaryRawWriterEx writer = ctx.writer(out); writer.writeObject(uuid); writer.writeObject(m); out.synchronize(); return ctx.gateway().messagingFilterApply(ptr, mem.pointer()) != 0; } }
/** {@inheritDoc} */ @Override public boolean apply(Object k, Object v) { try (PlatformMemory mem = ctx.memory().allocate()) { PlatformOutputStream out = mem.output(); BinaryRawWriterEx writer = ctx.writer(out); writer.writeLong(ptr); writer.writeObject(k); writer.writeObject(v); out.synchronize(); return ctx.gateway().cacheEntryFilterApply(mem.pointer()) != 0; } }
/** {@inheritDoc} */ @Override public void processInStreamOutStream(int type, BinaryRawReaderEx reader, BinaryRawWriterEx writer) throws IgniteCheckedException { if (type == OP_COMPARE_AND_SET_AND_GET) { Object val = reader.readObjectDetached(); final Object cmp = reader.readObjectDetached(); Object res = atomicRef.compareAndSetAndGet(val, cmp); if (cmp == res) writer.writeBoolean(true); else { writer.writeBoolean(false); writer.writeObject(res); } } else super.processInStreamOutStream(type, reader, writer); }
/** {@inheritDoc} */ @Override public boolean apply(ClusterNode clusterNode) { try (PlatformMemory mem = ctx.memory().allocate()) { PlatformOutputStream out = mem.output(); BinaryRawWriterEx writer = ctx.writer(out); writer.writeObject(pred); ctx.writeNode(writer, clusterNode); out.synchronize(); return ctx.gateway().clusterNodeFilterApply(mem.pointer()) != 0; } }
/** * Writes service context. * * @param ctx Context. * @param writer Writer. */ private void writeServiceContext(ServiceContext ctx, BinaryRawWriterEx writer) { writer.writeString(ctx.name()); writer.writeUuid(ctx.executionId()); writer.writeBoolean(ctx.isCancelled()); writer.writeString(ctx.cacheName()); writer.writeObject(ctx.affinityKey()); }
/** * Write common event data. * * @param writer Writer. * @param evt Event. */ private void writeCommonEventData(BinaryRawWriterEx writer, EventAdapter evt) { writer.writeObject(evt.id()); writer.writeLong(evt.localOrder()); writeNode(writer, evt.node()); writer.writeString(evt.message()); writer.writeInt(evt.type()); writer.writeString(evt.name()); writer.writeTimestamp(new Timestamp(evt.timestamp())); }
/** {@inheritDoc} */ @Override public void initialize(GridKernalContext kernalCtx) { if (ptr != 0) return; ctx = PlatformUtils.platformContext(kernalCtx.grid()); try (PlatformMemory mem = ctx.memory().allocate()) { PlatformOutputStream out = mem.output(); BinaryRawWriterEx writer = ctx.writer(out); writer.writeObject(pred); out.synchronize(); ptr = ctx.gateway().messagingFilterCreate(mem.pointer()); } }
/** {@inheritDoc} */ @Override public int partition(Object key) { if ((overrideFlags & FLAG_PARTITION) == 0) { assert baseFunc != null; return baseFunc.partition(key); } assert ctx != null; assert ptr != 0; try (PlatformMemory mem = ctx.memory().allocate()) { PlatformOutputStream out = mem.output(); BinaryRawWriterEx writer = ctx.writer(out); writer.writeLong(ptr); writer.writeObject(key); out.synchronize(); return ctx.gateway().affinityFunctionPartition(mem.pointer()); } }
/** * @param ignite Ignite instance. */ @IgniteInstanceResource public void setIgniteInstance(Ignite ignite) { ctx = PlatformUtils.platformContext(ignite); if (ptr != 0) return; try (PlatformMemory mem = ctx.memory().allocate()) { PlatformOutputStream out = mem.output(); BinaryRawWriterEx writer = ctx.writer(out); writer.writeObject(pred); out.synchronize(); ptr = ctx.gateway().cacheEntryFilterCreate(mem.pointer()); } } }
@Override public void write(BinaryRawWriterEx writer, PlatformDotNetBinaryTypeConfiguration typ) { writer.writeString(typ.getTypeName()); writer.writeString(typ.getNameMapper()); writer.writeString(typ.getIdMapper()); writer.writeString(typ.getSerializer()); writer.writeString(typ.getAffinityKeyFieldName()); writer.writeObject(typ.getKeepDeserialized()); writer.writeBoolean(typ.isEnum()); } });