anton-vinogradov commented on code in PR #13095:
URL: https://github.com/apache/ignite/pull/13095#discussion_r3578926917


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java:
##########
@@ -200,27 +201,28 @@ public void 
lastAffinityChangedTopologyVersion(AffinityTopologyVersion topVer) {
     public abstract boolean addDeploymentInfo();
 
     /**
-     * @param o Object to prepare for marshalling.
+     * @param o Object to deploy.
      * @param ctx Context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void prepareObject(@Nullable Object o, GridCacheContext 
ctx) throws IgniteCheckedException {
-        prepareObject(o, ctx.shared());
+    public final void deployObject(@Nullable Object o, @Nullable 
GridCacheContext ctx) throws IgniteCheckedException {

Review Comment:
   Fixed.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java:
##########
@@ -200,27 +201,28 @@ public void 
lastAffinityChangedTopologyVersion(AffinityTopologyVersion topVer) {
     public abstract boolean addDeploymentInfo();
 
     /**
-     * @param o Object to prepare for marshalling.
+     * @param o Object to deploy.
      * @param ctx Context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void prepareObject(@Nullable Object o, GridCacheContext 
ctx) throws IgniteCheckedException {
-        prepareObject(o, ctx.shared());
+    public final void deployObject(@Nullable Object o, @Nullable 
GridCacheContext ctx) throws IgniteCheckedException {
+        if (ctx != null)
+            deployObject(o, ctx.shared());
     }
 
     /**
-     * @param o Object to prepare for marshalling.
+     * @param o Object to deploy.
      * @param ctx Context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void prepareObject(@Nullable Object o, 
GridCacheSharedContext ctx) throws IgniteCheckedException {
+    final void deployObject(@Nullable Object o, GridCacheSharedContext ctx) 
throws IgniteCheckedException {

Review Comment:
   Fixed.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java:
##########
@@ -262,370 +270,234 @@ public GridDeploymentInfoBean deployInfo() {
         return depInfo;
     }
 
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws 
IgniteCheckedException {
-        // No-op.
-    }
-
-    /**
-     * This method is called after the message is deserialized and is 
responsible for
-     * unmarshalling state marshalled in {@link 
#prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader 
ldr) throws IgniteCheckedException {
-        // No-op.
-    }
-
     /**
      * @param info Entry to marshal.
      * @param ctx Context.
      * @param cacheObjCtx Cache object context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void marshalInfo(GridCacheEntryInfo info,
+    public final void deployInfo(GridCacheEntryInfo info,
         GridCacheSharedContext ctx,

Review Comment:
   Fixed.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java:
##########
@@ -262,370 +270,234 @@ public GridDeploymentInfoBean deployInfo() {
         return depInfo;
     }
 
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws 
IgniteCheckedException {
-        // No-op.
-    }
-
-    /**
-     * This method is called after the message is deserialized and is 
responsible for
-     * unmarshalling state marshalled in {@link 
#prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader 
ldr) throws IgniteCheckedException {
-        // No-op.
-    }
-
     /**
      * @param info Entry to marshal.
      * @param ctx Context.
      * @param cacheObjCtx Cache object context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void marshalInfo(GridCacheEntryInfo info,
+    public final void deployInfo(GridCacheEntryInfo info,
         GridCacheSharedContext ctx,
         CacheObjectContext cacheObjCtx
     ) throws IgniteCheckedException {
         assert ctx != null;
 
         if (info != null) {
-            info.marshal(cacheObjCtx);
-
             if (addDepInfo) {
                 if (info.key() != null)
-                    prepareObject(info.key().value(cacheObjCtx, false), ctx);
+                    deployObject(info.key().value(cacheObjCtx, false), ctx);
 
                 CacheObject val = info.value();
 
                 if (val != null) {
-                    val.finishUnmarshal(cacheObjCtx, 
ctx.deploy().globalLoader());
+                    val.unmarshal(cacheObjCtx, ctx.deploy().globalLoader());
 
-                    prepareObject(val.value(cacheObjCtx, false), ctx);
+                    deployObject(val.value(cacheObjCtx, false), ctx);
                 }
             }
         }
     }
 
-    /**
-     * @param info Entry to unmarshal.
-     * @param ctx Context.
-     * @param ldr Loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    protected final void unmarshalInfo(GridCacheEntryInfo info, 
GridCacheContext ctx,
-        ClassLoader ldr) throws IgniteCheckedException {
-        assert ldr != null;
-        assert ctx != null;
-
-        if (info != null)
-            info.unmarshal(ctx.cacheObjectContext(), ldr);
+    /** Deploys all {@code infos}, resolving shared and cache-object contexts 
from {@code cctx}; no-op when {@code cctx} is absent. */
+    public final void deployInfos(@Nullable Iterable<? extends 
GridCacheEntryInfo> infos, @Nullable GridCacheContext cctx)

Review Comment:
   Fixed — and swept the whole file: every raw 
`GridCacheContext`/`GridCacheSharedContext` in signatures and locals is `<?, 
?>` now.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java:
##########
@@ -262,370 +270,234 @@ public GridDeploymentInfoBean deployInfo() {
         return depInfo;
     }
 
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws 
IgniteCheckedException {
-        // No-op.
-    }
-
-    /**
-     * This method is called after the message is deserialized and is 
responsible for
-     * unmarshalling state marshalled in {@link 
#prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader 
ldr) throws IgniteCheckedException {
-        // No-op.
-    }
-
     /**
      * @param info Entry to marshal.
      * @param ctx Context.
      * @param cacheObjCtx Cache object context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void marshalInfo(GridCacheEntryInfo info,
+    public final void deployInfo(GridCacheEntryInfo info,
         GridCacheSharedContext ctx,
         CacheObjectContext cacheObjCtx
     ) throws IgniteCheckedException {
         assert ctx != null;
 
         if (info != null) {
-            info.marshal(cacheObjCtx);
-
             if (addDepInfo) {
                 if (info.key() != null)
-                    prepareObject(info.key().value(cacheObjCtx, false), ctx);
+                    deployObject(info.key().value(cacheObjCtx, false), ctx);
 
                 CacheObject val = info.value();
 
                 if (val != null) {
-                    val.finishUnmarshal(cacheObjCtx, 
ctx.deploy().globalLoader());
+                    val.unmarshal(cacheObjCtx, ctx.deploy().globalLoader());
 
-                    prepareObject(val.value(cacheObjCtx, false), ctx);
+                    deployObject(val.value(cacheObjCtx, false), ctx);
                 }
             }
         }
     }
 
-    /**
-     * @param info Entry to unmarshal.
-     * @param ctx Context.
-     * @param ldr Loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    protected final void unmarshalInfo(GridCacheEntryInfo info, 
GridCacheContext ctx,
-        ClassLoader ldr) throws IgniteCheckedException {
-        assert ldr != null;
-        assert ctx != null;
-
-        if (info != null)
-            info.unmarshal(ctx.cacheObjectContext(), ldr);
+    /** Deploys all {@code infos}, resolving shared and cache-object contexts 
from {@code cctx}; no-op when {@code cctx} is absent. */
+    public final void deployInfos(@Nullable Iterable<? extends 
GridCacheEntryInfo> infos, @Nullable GridCacheContext cctx)
+        throws IgniteCheckedException {
+        if (cctx != null)
+            deployInfos(infos, cctx.shared(), cctx.cacheObjectContext());
     }
 
     /**
      * @param infos Entries to marshal.
      * @param ctx Context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void marshalInfos(
-        Iterable<? extends GridCacheEntryInfo> infos,
-        GridCacheSharedContext ctx,
-        CacheObjectContext cacheObjCtx
-    ) throws IgniteCheckedException {
+    final void deployInfos(Iterable<? extends GridCacheEntryInfo> infos, 
GridCacheSharedContext ctx,
+        CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
         assert ctx != null;
 
         if (infos != null)

Review Comment:
   Fixed.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java:
##########
@@ -262,370 +270,234 @@ public GridDeploymentInfoBean deployInfo() {
         return depInfo;
     }
 
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws 
IgniteCheckedException {
-        // No-op.
-    }
-
-    /**
-     * This method is called after the message is deserialized and is 
responsible for
-     * unmarshalling state marshalled in {@link 
#prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader 
ldr) throws IgniteCheckedException {
-        // No-op.
-    }
-
     /**
      * @param info Entry to marshal.
      * @param ctx Context.
      * @param cacheObjCtx Cache object context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void marshalInfo(GridCacheEntryInfo info,
+    public final void deployInfo(GridCacheEntryInfo info,
         GridCacheSharedContext ctx,
         CacheObjectContext cacheObjCtx
     ) throws IgniteCheckedException {
         assert ctx != null;
 
         if (info != null) {
-            info.marshal(cacheObjCtx);
-
             if (addDepInfo) {
                 if (info.key() != null)
-                    prepareObject(info.key().value(cacheObjCtx, false), ctx);
+                    deployObject(info.key().value(cacheObjCtx, false), ctx);
 
                 CacheObject val = info.value();
 
                 if (val != null) {
-                    val.finishUnmarshal(cacheObjCtx, 
ctx.deploy().globalLoader());
+                    val.unmarshal(cacheObjCtx, ctx.deploy().globalLoader());
 
-                    prepareObject(val.value(cacheObjCtx, false), ctx);
+                    deployObject(val.value(cacheObjCtx, false), ctx);
                 }
             }
         }
     }
 
-    /**
-     * @param info Entry to unmarshal.
-     * @param ctx Context.
-     * @param ldr Loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    protected final void unmarshalInfo(GridCacheEntryInfo info, 
GridCacheContext ctx,
-        ClassLoader ldr) throws IgniteCheckedException {
-        assert ldr != null;
-        assert ctx != null;
-
-        if (info != null)
-            info.unmarshal(ctx.cacheObjectContext(), ldr);
+    /** Deploys all {@code infos}, resolving shared and cache-object contexts 
from {@code cctx}; no-op when {@code cctx} is absent. */
+    public final void deployInfos(@Nullable Iterable<? extends 
GridCacheEntryInfo> infos, @Nullable GridCacheContext cctx)
+        throws IgniteCheckedException {
+        if (cctx != null)
+            deployInfos(infos, cctx.shared(), cctx.cacheObjectContext());
     }
 
     /**
      * @param infos Entries to marshal.
      * @param ctx Context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void marshalInfos(
-        Iterable<? extends GridCacheEntryInfo> infos,
-        GridCacheSharedContext ctx,
-        CacheObjectContext cacheObjCtx
-    ) throws IgniteCheckedException {
+    final void deployInfos(Iterable<? extends GridCacheEntryInfo> infos, 
GridCacheSharedContext ctx,
+        CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
         assert ctx != null;
 
         if (infos != null)

Review Comment:
   Done.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java:
##########
@@ -262,370 +270,234 @@ public GridDeploymentInfoBean deployInfo() {
         return depInfo;
     }
 
-    /**
-     * This method is called before the whole message is serialized
-     * and is responsible for pre-marshalling state.
-     *
-     * @param ctx Cache context.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) throws 
IgniteCheckedException {
-        // No-op.
-    }
-
-    /**
-     * This method is called after the message is deserialized and is 
responsible for
-     * unmarshalling state marshalled in {@link 
#prepareMarshal(GridCacheSharedContext)} method.
-     *
-     * @param ctx Context.
-     * @param ldr Class loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx, ClassLoader 
ldr) throws IgniteCheckedException {
-        // No-op.
-    }
-
     /**
      * @param info Entry to marshal.
      * @param ctx Context.
      * @param cacheObjCtx Cache object context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void marshalInfo(GridCacheEntryInfo info,
+    public final void deployInfo(GridCacheEntryInfo info,
         GridCacheSharedContext ctx,
         CacheObjectContext cacheObjCtx
     ) throws IgniteCheckedException {
         assert ctx != null;
 
         if (info != null) {
-            info.marshal(cacheObjCtx);
-
             if (addDepInfo) {
                 if (info.key() != null)
-                    prepareObject(info.key().value(cacheObjCtx, false), ctx);
+                    deployObject(info.key().value(cacheObjCtx, false), ctx);
 
                 CacheObject val = info.value();
 
                 if (val != null) {
-                    val.finishUnmarshal(cacheObjCtx, 
ctx.deploy().globalLoader());
+                    val.unmarshal(cacheObjCtx, ctx.deploy().globalLoader());
 
-                    prepareObject(val.value(cacheObjCtx, false), ctx);
+                    deployObject(val.value(cacheObjCtx, false), ctx);
                 }
             }
         }
     }
 
-    /**
-     * @param info Entry to unmarshal.
-     * @param ctx Context.
-     * @param ldr Loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    protected final void unmarshalInfo(GridCacheEntryInfo info, 
GridCacheContext ctx,
-        ClassLoader ldr) throws IgniteCheckedException {
-        assert ldr != null;
-        assert ctx != null;
-
-        if (info != null)
-            info.unmarshal(ctx.cacheObjectContext(), ldr);
+    /** Deploys all {@code infos}, resolving shared and cache-object contexts 
from {@code cctx}; no-op when {@code cctx} is absent. */
+    public final void deployInfos(@Nullable Iterable<? extends 
GridCacheEntryInfo> infos, @Nullable GridCacheContext cctx)
+        throws IgniteCheckedException {
+        if (cctx != null)
+            deployInfos(infos, cctx.shared(), cctx.cacheObjectContext());
     }
 
     /**
      * @param infos Entries to marshal.
      * @param ctx Context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void marshalInfos(
-        Iterable<? extends GridCacheEntryInfo> infos,
-        GridCacheSharedContext ctx,
-        CacheObjectContext cacheObjCtx
-    ) throws IgniteCheckedException {
+    final void deployInfos(Iterable<? extends GridCacheEntryInfo> infos, 
GridCacheSharedContext ctx,
+        CacheObjectContext cacheObjCtx) throws IgniteCheckedException {
         assert ctx != null;
 
         if (infos != null)
             for (GridCacheEntryInfo e : infos)
-                marshalInfo(e, ctx, cacheObjCtx);
-    }
-
-    /**
-     * @param infos Entries to unmarshal.
-     * @param ctx Context.
-     * @param ldr Loader.
-     * @throws IgniteCheckedException If failed.
-     */
-    protected final void unmarshalInfos(Iterable<? extends GridCacheEntryInfo> 
infos,
-        GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        assert ldr != null;
-        assert ctx != null;
-
-        if (infos != null)
-            for (GridCacheEntryInfo e : infos)
-                unmarshalInfo(e, ctx, ldr);
+                deployInfo(e, ctx, cacheObjCtx);
     }
 
     /**
      * @param txEntries Entries to marshal.
      * @param ctx Context.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void marshalTx(Iterable<IgniteTxEntry> txEntries, 
GridCacheSharedContext ctx)
+    public final void deployTx(Iterable<IgniteTxEntry> txEntries, 
GridCacheSharedContext ctx)
         throws IgniteCheckedException {
         assert ctx != null;
 
         if (txEntries != null) {
-            boolean transferExpiry = transferExpiryPolicy();
             boolean p2pEnabled = ctx.deploymentEnabled();
 
             for (IgniteTxEntry e : txEntries) {
-                e.marshal(ctx, transferExpiry);
-
                 GridCacheContext cctx = e.context();
 
                 if (addDepInfo) {
                     if (e.key() != null)
-                        prepareObject(e.key().value(cctx.cacheObjectContext(), 
false), ctx);
+                        deployObject(e.key().value(cctx.cacheObjectContext(), 
false), ctx);
 
                     if (e.value() != null)
-                        
prepareObject(e.value().value(cctx.cacheObjectContext(), false), ctx);
+                        
deployObject(e.value().value(cctx.cacheObjectContext(), false), ctx);
 
                     if (e.entryProcessors() != null) {
                         for (T2<EntryProcessor<Object, Object, Object>, 
Object[]> entProc : e.entryProcessors())
-                            prepareObject(entProc.get1(), ctx);
+                            deployObject(entProc.get1(), ctx);
                     }
                 }
                 else if (p2pEnabled && e.entryProcessors() != null) {
                     if (!forceAddDepInfo)
                         forceAddDepInfo = true;
 
                     for (T2<EntryProcessor<Object, Object, Object>, Object[]> 
entProc : e.entryProcessors())
-                        prepareObject(entProc.get1(), ctx);
+                        deployObject(entProc.get1(), ctx);
                 }
             }
         }
     }
 
     /**
-     * @return {@code True} if entries expire policy should be marshalled.
-     */
-    protected boolean transferExpiryPolicy() {
-        return false;
-    }
-
-    /**
-     * @param txEntries Entries to unmarshal.
-     * @param ctx Context.
-     * @param ldr Loader.
+     * @param args Arguments to marshal.
+     * @param marsh Marshaller.
+     * @return Marshalled collection.
      * @throws IgniteCheckedException If failed.
      */
-    protected final void unmarshalTx(Iterable<IgniteTxEntry> txEntries,
-        GridCacheSharedContext ctx,
-        ClassLoader ldr) throws IgniteCheckedException {
-        assert ldr != null;
-        assert ctx != null;
+    @Nullable protected final List<byte[]> marshallInvokeArguments(@Nullable 
Object[] args, Marshaller marsh)

Review Comment:
   Fixed — the return-type `@Nullable` now sits next to the type (`protected 
final @Nullable List<byte[]>`), same for `unmarshalInvokeArguments`, 
`marshallCollection` and `unmarshalCollection`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to