You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/28 14:16:04 UTC

[GitHub] [pulsar] linlinnn opened a new pull request #10423: [schema] simplify code

linlinnn opened a new pull request #10423:
URL: https://github.com/apache/pulsar/pull/10423


   ### Motivation
   simplify code


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



[GitHub] [pulsar] linlinnn commented on a change in pull request #10423: [schema] simplify code

Posted by GitBox <gi...@apache.org>.
linlinnn commented on a change in pull request #10423:
URL: https://github.com/apache/pulsar/pull/10423#discussion_r622668682



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java
##########
@@ -102,12 +102,7 @@ public boolean supportSchemaVersioning() {
     }
 
     public static <T> AvroSchema<T> of(Class<T> pojo, Map<String, String> properties) {
-        ClassLoader pojoClassLoader = null;
-        if (pojo != null) {
-            pojoClassLoader = pojo.getClassLoader();
-        }
-        SchemaDefinition<T> schemaDefinition = SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build();
-        return new AvroSchema<>(parseSchemaInfo(schemaDefinition, SchemaType.AVRO), pojoClassLoader);
+        return AvroSchema.of(SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build());

Review comment:
       The next call will perform the same behavior[Please take a look here](https://github.com/apache/pulsar/blob/5712695817c3ccace6047e65674061bb104a334f/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java#L94)
   




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



[GitHub] [pulsar] linlinnn commented on a change in pull request #10423: [schema] simplify code

Posted by GitBox <gi...@apache.org>.
linlinnn commented on a change in pull request #10423:
URL: https://github.com/apache/pulsar/pull/10423#discussion_r622668682



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java
##########
@@ -102,12 +102,7 @@ public boolean supportSchemaVersioning() {
     }
 
     public static <T> AvroSchema<T> of(Class<T> pojo, Map<String, String> properties) {
-        ClassLoader pojoClassLoader = null;
-        if (pojo != null) {
-            pojoClassLoader = pojo.getClassLoader();
-        }
-        SchemaDefinition<T> schemaDefinition = SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build();
-        return new AvroSchema<>(parseSchemaInfo(schemaDefinition, SchemaType.AVRO), pojoClassLoader);
+        return AvroSchema.of(SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build());

Review comment:
       @codelipenghui 
   The next call method will perform the same behavior [Please take a look here](https://github.com/apache/pulsar/blob/5712695817c3ccace6047e65674061bb104a334f/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java#L94)
   




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



[GitHub] [pulsar] codelipenghui commented on a change in pull request #10423: [schema] simplify code

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #10423:
URL: https://github.com/apache/pulsar/pull/10423#discussion_r622659669



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java
##########
@@ -102,12 +102,7 @@ public boolean supportSchemaVersioning() {
     }
 
     public static <T> AvroSchema<T> of(Class<T> pojo, Map<String, String> properties) {
-        ClassLoader pojoClassLoader = null;
-        if (pojo != null) {
-            pojoClassLoader = pojo.getClassLoader();
-        }
-        SchemaDefinition<T> schemaDefinition = SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build();
-        return new AvroSchema<>(parseSchemaInfo(schemaDefinition, SchemaType.AVRO), pojoClassLoader);
+        return AvroSchema.of(SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build());

Review comment:
       This change will change the behavior since we are using the pojo classloader before.




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



[GitHub] [pulsar] merlimat merged pull request #10423: [schema] simplify code

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #10423:
URL: https://github.com/apache/pulsar/pull/10423


   


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



[GitHub] [pulsar] linlinnn commented on a change in pull request #10423: [schema] simplify code

Posted by GitBox <gi...@apache.org>.
linlinnn commented on a change in pull request #10423:
URL: https://github.com/apache/pulsar/pull/10423#discussion_r622668682



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java
##########
@@ -102,12 +102,7 @@ public boolean supportSchemaVersioning() {
     }
 
     public static <T> AvroSchema<T> of(Class<T> pojo, Map<String, String> properties) {
-        ClassLoader pojoClassLoader = null;
-        if (pojo != null) {
-            pojoClassLoader = pojo.getClassLoader();
-        }
-        SchemaDefinition<T> schemaDefinition = SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build();
-        return new AvroSchema<>(parseSchemaInfo(schemaDefinition, SchemaType.AVRO), pojoClassLoader);
+        return AvroSchema.of(SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build());

Review comment:
       The next call method will perform the same behavior [Please take a look here](https://github.com/apache/pulsar/blob/5712695817c3ccace6047e65674061bb104a334f/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java#L94)
   




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



[GitHub] [pulsar] linlinnn commented on a change in pull request #10423: [schema] simplify code

Posted by GitBox <gi...@apache.org>.
linlinnn commented on a change in pull request #10423:
URL: https://github.com/apache/pulsar/pull/10423#discussion_r622668682



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java
##########
@@ -102,12 +102,7 @@ public boolean supportSchemaVersioning() {
     }
 
     public static <T> AvroSchema<T> of(Class<T> pojo, Map<String, String> properties) {
-        ClassLoader pojoClassLoader = null;
-        if (pojo != null) {
-            pojoClassLoader = pojo.getClassLoader();
-        }
-        SchemaDefinition<T> schemaDefinition = SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build();
-        return new AvroSchema<>(parseSchemaInfo(schemaDefinition, SchemaType.AVRO), pojoClassLoader);
+        return AvroSchema.of(SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build());

Review comment:
       The next call will perform the same behavior [Please take a look here](https://github.com/apache/pulsar/blob/5712695817c3ccace6047e65674061bb104a334f/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java#L94)
   




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



[GitHub] [pulsar] linlinnn commented on a change in pull request #10423: [schema] simplify code

Posted by GitBox <gi...@apache.org>.
linlinnn commented on a change in pull request #10423:
URL: https://github.com/apache/pulsar/pull/10423#discussion_r622668682



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java
##########
@@ -102,12 +102,7 @@ public boolean supportSchemaVersioning() {
     }
 
     public static <T> AvroSchema<T> of(Class<T> pojo, Map<String, String> properties) {
-        ClassLoader pojoClassLoader = null;
-        if (pojo != null) {
-            pojoClassLoader = pojo.getClassLoader();
-        }
-        SchemaDefinition<T> schemaDefinition = SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build();
-        return new AvroSchema<>(parseSchemaInfo(schemaDefinition, SchemaType.AVRO), pojoClassLoader);
+        return AvroSchema.of(SchemaDefinition.<T>builder().withPojo(pojo).withProperties(properties).build());

Review comment:
       @codelipenghui @eolivelli 
   The next call method will perform the same behavior [Please take a look here](https://github.com/apache/pulsar/blob/5712695817c3ccace6047e65674061bb104a334f/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AvroSchema.java#L94)
   




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