You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/04/20 22:48:49 UTC

[GitHub] [ignite] Mikhail1988 commented on a change in pull request #7663: Ignite 12702

Mikhail1988 commented on a change in pull request #7663:
URL: https://github.com/apache/ignite/pull/7663#discussion_r411743028



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
##########
@@ -1288,9 +1293,26 @@ private void validate(Query qry) {
         }
     }
 
+    /**
+     * Warns if an ineffective annotation is used
+     *
+     * @param valueCls Value class
+     */
+    private void checkIneffectiveAnnotations(Class valueCls) {
+        for (Field f:valueCls.getDeclaredFields()) {
+            AffinityKeyMapped[] annotations = f.getDeclaredAnnotationsByType(AffinityKeyMapped.class);
+            if (annotations.length > 0) {
+                LT.warn(log,
+                        "AffinityKeyMapped annotation should be used on key and not value type");
+            }
+
+        }
+    }
+
     /** {@inheritDoc} */
     @Override public void put(K key, V val) {
         IgniteInternalCache<K, V> delegate = getDelegateSafe();
+        checkIneffectiveAnnotations(val.getClass());

Review comment:
       Reflection use on each put, really? it will kill performance. Please move this check to new type registration method, I believe you will find it in BinaryMarshaller or somewhere around.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org