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/21 17:18:54 UTC

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

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



##########
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:
       Thank you, I called out the performance cost of reflection on the [issue](https://issues.apache.org/jira/browse/IGNITE-12702?jql=project%20%3D%20IGNITE%20AND%20labels%20in%20(newbie)%20and%20status%20%3D%20OPEN) itself almost a month back. Didn't know about BinaryMarshaller, will use it




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