class PlatformAbstractFunc implements PlatformSecurityAwareJob, Serializable {
    /** */
    private static final long serialVersionUID = 0L;

    /** Serialized platform func. */
    private final Object func;

    /** Handle for local execution. */
    @SuppressWarnings("TransientFieldNotInitialized")
    private final transient long ptr;

    /** Ignite instance. */
    @IgniteInstanceResource
    protected transient Ignite ignite;

    /** Platform function name. */
    private final String funcName;

    /**
     * Constructor.
     *
     * @param func Platform func.
     * @param ptr Handle for local execution.
     * @param funcName Platform function name.
     */
    protected PlatformAbstractFunc(Object func, long ptr, String funcName) {
        this.ptr = ptr;
        assert func != null;

        this.func = func;
        this.funcName = funcName;
    }

    /**
     * Invokes this instance.
     *
     * @return Invocation result.
     */
    protected Object invoke() throws IgniteCheckedException {<FILL_FUNCTION_BODY>}

    /** {@inheritDoc} */
    @Override public String name() {
        return funcName;
    }

    /**
     * Performs platform callback.
     *
     * @param gate Gateway.
     * @param memPtr Pointer.
     */
    protected abstract void platformCallback(PlatformCallbackGateway gate, long memPtr);
}

        assert ignite != null;

        PlatformContext ctx = PlatformUtils.platformContext(ignite);

        try (PlatformMemory mem = ctx.memory().allocate()) {
            PlatformOutputStream out = mem.output();

            if (ptr != 0) {
                out.writeBoolean(true);
                out.writeLong(ptr);
            }
            else {
                out.writeBoolean(false);
                ctx.writer(out).writeObject(func);
            }

            out.synchronize();
            platformCallback(ctx.gateway(), mem.pointer());

            PlatformInputStream in = mem.input();
            in.synchronize();

            return PlatformUtils.readInvocationResult(ctx, ctx.reader(in));
        }
    
<no_super_class>