/** * Unmarshalls transfer object from remote node within a given context. * * @param ctx Grid kernal context that provides deployment and marshalling services. * @param sndNodeId {@link UUID} of the sender node. * @param msg Transfer object that contains original serialized object and deployment information. * @return Unmarshalled object. * @throws IgniteCheckedException If node cannot obtain deployment. */ static Object unmarshall(GridKernalContext ctx, UUID sndNodeId, GridAffinityMessage msg) throws IgniteCheckedException { GridDeployment dep = ctx.deploy() .getGlobalDeployment( msg.deploymentMode(), msg.sourceClassName(), msg.sourceClassName(), msg.userVersion(), sndNodeId, msg.classLoaderId(), msg.loaderParticipants(), null); if (dep == null) throw new IgniteDeploymentCheckedException( "Failed to obtain affinity object (is peer class loading turned on?): " + msg); Object src = U.unmarshal(ctx, msg.source(), U.resolveClassLoader(dep.classLoader(), ctx.config())); // Resource injection. ctx.resource().inject(dep, dep.deployedClass(msg.sourceClassName()), src); return src; }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException { assert p != null || bytes != null; if (p == null) { p = U.unmarshal(ctx.marshaller(), bytes, U.resolveClassLoader(ldr, ctx.gridConfig())); p.finishUnmarshal(ctx, ldr); } }