hugogu commented on PR #89:
URL: 
https://github.com/apache/flink-connector-kafka/pull/89#issuecomment-2034714493

   @MartijnVisser May I have your advice on the use of 
`TemporaryClassLoaderContext` in the implementation? It looks  unnecessary to 
me. Do you think I should just remove it in this PR?
   
   ```java
       public void open(InitializationContext context) throws Exception {
           final ClassLoader userCodeClassLoader = 
context.getUserCodeClassLoader().asClassLoader();
           try (TemporaryClassLoaderContext ignored =
                   TemporaryClassLoaderContext.of(userCodeClassLoader)) {
               serializer =
                       InstantiationUtil.instantiate(
                               serializerClass.getName(),
                               Serializer.class,
                               userCodeClassLoader);
   
               if (serializer instanceof Configurable) {
                   ((Configurable) serializer).configure(config);
               } else {
                   serializer.configure(config, isKey);
               }
           } catch (Exception e) {
               throw new IOException("Failed to instantiate the serializer of 
class " + serializer, e);
           }
       }
   ```


-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to