slfan1989 commented on code in PR #7453:
URL: https://github.com/apache/hadoop/pull/7453#discussion_r1980328964


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/AbstractTimelineReaderHBaseTestBase.java:
##########
@@ -109,19 +106,25 @@ protected void addFilters(Configuration conf) {
   }
 
   protected Client createClient() {
-    ClientConfig cfg = new DefaultClientConfig();
-    cfg.getClasses().add(YarnJacksonJaxbJsonProvider.class);
-    return new Client(
-        new URLConnectionClientHandler(new DummyURLConnectionFactory()), cfg);
+    final ClientConfig cc = new ClientConfig();
+    cc.connectorProvider(getHttpURLConnectionFactory());
+    return ClientBuilder.newClient(cc)
+        .register(TimelineEntityReader.class)

Review Comment:
   This is a good question. I believe we need to update some parts of the code 
to align with Jersey 2's standards, as certain parts of the code are not 
well-supported by the latest standards. 
   
   I first became aware of the issue with Jersey during the release of Hadoop 
3.4.0, when aajisaka mentioned that, with Hadoop supporting JDK 11, there was 
an area that needed optimization — Jersey support. For more details, you can 
refer to HADOOP-15984 (updating Jersey from 1.19 to 2.x).
   
   Jersey is a framework that supports RESTful WebService. When upgrading from 
version 1.x to 2.x, compatibility issues arise because these two versions are 
completely incompatible, with even basic methods being different.
   
   To address this, we define custom readers because Jersey 2.x only supports 
automatic JSON conversion for basic data types and does not support automatic 
conversion for more complex types. More details can be found in the [official 
documentation](https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/message-body-workers.html#d0e6976).
   
   While writing these readers, I used 
`com.fasterxml.jackson.databind.ObjectMapper` to implement automatic conversion 
between objects and JSON. However, ObjectMapper cannot handle null pointer 
exceptions, which leads to the first question — the need to assign initial 
values to certain variables.
   
   After upgrading to JUnit 5, we will configure a new JDK 17 CI pipeline. 
Following that, I will begin the deeper adaptation and upgrade of Jersey 2.



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

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to