/** * Register local classes. * * @param objs Objects to register. * @throws IgniteCheckedException If registration failed. */ public void registerClasses(Iterable<?> objs) throws IgniteCheckedException { if (objs != null) for (Object o : objs) registerClass(o); }
/** * @param ctx Cache context. * @param depEnabled deployment enabled flag. * @param obj Object to marshal. * @return Buffer that contains obtained byte array. * @throws IgniteCheckedException If marshalling failed. */ public static byte[] marshal(GridCacheSharedContext ctx, boolean depEnabled, Object obj) throws IgniteCheckedException { assert ctx != null; if (depEnabled) { if (obj != null) { if (obj instanceof Iterable) ctx.deploy().registerClasses((Iterable<?>)obj); else if (obj.getClass().isArray()) { if (!U.isPrimitiveArray(obj)) ctx.deploy().registerClasses((Object[])obj); } else ctx.deploy().registerClass(obj); } } return U.marshal(ctx, obj); }
/** * @param cls Class to register. * @throws IgniteCheckedException If failed. */ public void registerClass(Class<?> cls) throws IgniteCheckedException { if (cls == null) return; registerClass(cls, U.detectClassLoader(cls)); }
/** * @param ctx Cache context. * @param depEnabled deployment enabled flag. * @param obj Object to marshal. * @return Buffer that contains obtained byte array. * @throws IgniteCheckedException If marshalling failed. */ public static byte[] marshal(GridCacheSharedContext ctx, boolean depEnabled, Object obj) throws IgniteCheckedException { assert ctx != null; if (depEnabled) { if (obj != null) { if (obj instanceof Iterable) ctx.deploy().registerClasses((Iterable<?>)obj); else if (obj.getClass().isArray()) { if (!U.isPrimitiveArray(obj)) ctx.deploy().registerClasses((Object[])obj); } else ctx.deploy().registerClass(obj); } } return U.marshal(ctx, obj); }
/** * @param obj Object whose class to register. * @throws IgniteCheckedException If failed. */ public void registerClass(Object obj) throws IgniteCheckedException { if (obj == null) return; if (obj instanceof GridPeerDeployAware) { GridPeerDeployAware p = (GridPeerDeployAware)obj; registerClass(p.deployClass(), p.classLoader()); } else registerClass(obj instanceof Class ? (Class)obj : obj.getClass()); }
/** * @param o Object to prepare for marshalling. * @param ctx Context. * @throws IgniteCheckedException If failed. */ protected final void prepareObject(@Nullable Object o, GridCacheSharedContext ctx) throws IgniteCheckedException { assert addDepInfo || forceAddDepInfo; if (!skipPrepare && o != null) { GridDeploymentInfo d = ctx.deploy().globalDeploymentInfo(); if (d != null) { prepare(d); // Global deployment has been injected. skipPrepare = true; } else { Class<?> cls = U.detectClass(o); ctx.deploy().registerClass(cls); ClassLoader ldr = U.detectClassLoader(cls); if (ldr instanceof GridDeploymentInfo) prepare((GridDeploymentInfo)ldr); } } }
/** * Register local classes. * * @param objs Objects to register. * @throws IgniteCheckedException If registration failed. */ public void registerClasses(Iterable<?> objs) throws IgniteCheckedException { if (objs != null) for (Object o : objs) registerClass(o); }
/** * @param cls Class to register. * @throws IgniteCheckedException If failed. */ public void registerClass(Class<?> cls) throws IgniteCheckedException { if (cls == null) return; registerClass(cls, U.detectClassLoader(cls)); }
/** * @param obj Object whose class to register. * @throws IgniteCheckedException If failed. */ public void registerClass(Object obj) throws IgniteCheckedException { if (obj == null) return; if (obj instanceof GridPeerDeployAware) { GridPeerDeployAware p = (GridPeerDeployAware)obj; registerClass(p.deployClass(), p.classLoader()); } else registerClass(obj instanceof Class ? (Class)obj : obj.getClass()); }
/** * @param o Object to prepare for marshalling. * @param ctx Context. * @throws IgniteCheckedException If failed. */ protected final void prepareObject(@Nullable Object o, GridCacheSharedContext ctx) throws IgniteCheckedException { assert addDepInfo || forceAddDepInfo; if (!skipPrepare && o != null) { GridDeploymentInfo d = ctx.deploy().globalDeploymentInfo(); if (d != null) { prepare(d); // Global deployment has been injected. skipPrepare = true; } else { Class<?> cls = U.detectClass(o); ctx.deploy().registerClass(cls); ClassLoader ldr = U.detectClassLoader(cls); if (ldr instanceof GridDeploymentInfo) prepare((GridDeploymentInfo)ldr); } } }