smallzhongfeng commented on code in PR #684:
URL: https://github.com/apache/incubator-uniffle/pull/684#discussion_r1129050595


##########
coordinator/src/main/java/org/apache/uniffle/coordinator/web/request/DecommissionRequest.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.coordinator.web.request;
+
+import java.util.List;
+
+public class DecommissionRequest {
+  private List<String> serverIds;

Review Comment:
   What about `List` -> `Set` ? It seems that there is no logic to handle 
duplicate serverId.



##########
coordinator/src/main/java/org/apache/uniffle/coordinator/web/request/CancelDecommissionRequest.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.coordinator.web.request;
+
+import java.util.List;
+
+public class CancelDecommissionRequest {
+  private List<String> serverIds;

Review Comment:
   What about List -> Set ? It seems that there is no logic to handle duplicate 
serverId.



##########
coordinator/src/main/java/org/apache/uniffle/coordinator/web/request/DecommissionRequest.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.coordinator.web.request;
+
+import java.util.List;
+
+public class DecommissionRequest {
+  private List<String> serverIds;
+
+  public List<String> getServerIds() {
+    return serverIds;
+  }
+
+  public void setServerIds(List<String> serverIds) {
+    this.serverIds = serverIds;
+  }
+

Review Comment:
   Remove blank lines



##########
coordinator/src/main/java/org/apache/uniffle/coordinator/web/servlet/BaseServlet.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.coordinator.web.servlet;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.concurrent.Callable;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.uniffle.coordinator.web.Response;
+
+public abstract class BaseServlet extends HttpServlet {
+  public static final String JSON_MIME_TYPE = "application/json";
+  final ObjectMapper mapper = new 
ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
+
+  @Override
+  protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
throws IOException {
+    writeJSON(resp, handlerRequest(() -> handleGet(req, resp)));
+  }
+
+  @Override
+  protected void doPost(HttpServletRequest req, HttpServletResponse resp) 
throws IOException {
+    writeJSON(resp, handlerRequest(() -> handlePost(req, resp)));
+  }
+
+  private Response handlerRequest(
+      Callable<Response> function) {
+    Response response;
+    try {
+      // todo: Do something for authentication
+      response = function.call();
+    } catch (Exception e) {
+      response = Response.fail(e.getMessage());
+    }
+    return response;
+  }
+
+  protected Response handleGet(
+      HttpServletRequest req,
+      HttpServletResponse resp) throws ServletException, IOException {
+    throw new IOException("Method not support!");
+  }
+
+

Review Comment:
   Remove blank lines



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