eolivelli commented on a change in pull request #9551:
URL: https://github.com/apache/pulsar/pull/9551#discussion_r575034981



##########
File path: 
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/EnsemblePlacementPolicyConfig.java
##########
@@ -30,6 +31,8 @@
     private final Class policyClass;
     private final Map<String, Object> properties;
 
+    private static ObjectMapper mapper = new ObjectMapper();

Review comment:
       @merlimat  that makes sense to me.
   In fact usually you create a `static` ObjectMapper when you are sure that it 
will deal only with a limited and fixed set classes .
   
   in this case the ObjectMapper will deal only with this class, and thus it is 
safe to use a static instance.,
   
   As just said before, I prefer to have a consistent way of coding, so here in 
Pulsar is it fine to me to use ObjectManagerFactory. The overhead is to create 
a ObjectMapper (and the internal cache) per thread instead of having just one 
per target class.
   




----------------------------------------------------------------
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:
[email protected]


Reply via email to