Skip to content

Commit

Permalink
[ISSUE#3249]Resolve the issues of codestyle of nacos-config module(pa…
Browse files Browse the repository at this point in the history
…rameters/enums/exception/filter/manager/model/service). (alibaba#3259)
  • Loading branch information
zongtanghu authored Jul 6, 2020
1 parent 4278b48 commit 9966ec3
Show file tree
Hide file tree
Showing 54 changed files with 189 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
package com.alibaba.nacos.config.server.controller.parameters;

/**
* SameNamespaceCloneConfigBean.
*
* @author klw(213539 @ qq.com)
* @ClassName: SameNamespaceCloneConfigBean
* @Description: 同namespace克隆接口的配制bean
* @date 2019/12/13 16:10
*/
public class SameNamespaceCloneConfigBean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,70 +17,60 @@
package com.alibaba.nacos.config.server.enums;

/**
* Config file type enum.
*
* @author klw
* @ClassName: FileTypeEnum
* @Description: config file type enum
* @date 2019/7/1 10:21
*/
public enum FileTypeEnum {

/**
* @author klw
* @Description: yaml file
* Yaml file.
*/
YML("yaml"),

/**
* @author klw
* @Description: yaml file
* Yaml file.
*/
YAML("yaml"),

/**
* @author klw
* @Description: text file
* Text file.
*/
TXT("text"),

/**
* @author klw
* @Description: text file
* Text file.
*/
TEXT("text"),

/**
* @author klw
* @Description: json file
* Json file.
*/
JSON("json"),

/**
* @author klw
* @Description: xml file
* Xml file.
*/
XML("xml"),

/**
* @author klw
* @Description: html file
* Html file.
*/
HTM("html"),

/**
* @author klw
* @Description: html file
* Html file.
*/
HTML("html"),

/**
* @author klw
* @Description: properties file
* Properties file.
*/
PROPERTIES("properties");

/**
* @author klw
* @Description: file type corresponding to file extension
* File type corresponding to file extension.
*/
private String fileType;

Expand All @@ -91,6 +81,4 @@ public enum FileTypeEnum {
public String getFileType() {
return this.fileType;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.io.IOException;

/**
* global exception handler
* Global exception handler.
*
* @author Nacos
*/
Expand All @@ -38,7 +38,7 @@ public class GlobalExceptionHandler {
* For IllegalArgumentException, we are returning void with status code as 400, so our error-page will be used in
* this case.
*
* @throws IllegalArgumentException
* @throws IllegalArgumentException IllegalArgumentException.
*/
@ExceptionHandler(IllegalArgumentException.class)
public ResponseEntity<String> handleIllegalArgumentException(Exception ex) throws IOException {
Expand All @@ -47,9 +47,9 @@ public ResponseEntity<String> handleIllegalArgumentException(Exception ex) throw
}

/**
* For NacosException
* For NacosException.
*
* @throws NacosException
* @throws NacosException NacosException.
*/
@ExceptionHandler(NacosException.class)
public ResponseEntity<String> handleNacosException(NacosException ex) throws IOException {
Expand All @@ -58,14 +58,13 @@ public ResponseEntity<String> handleNacosException(NacosException ex) throws IOE
}

/**
* For DataAccessException
* For DataAccessException.
*
* @throws DataAccessException
* @throws DataAccessException DataAccessException.
*/
@ExceptionHandler(DataAccessException.class)
public ResponseEntity<String> handleDataAccessException(DataAccessException ex) throws DataAccessException {
MetricsMonitor.getDbException().increment();
return ResponseEntity.status(500).body(ExceptionUtil.getAllExceptionMsg(ex));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.springframework.dao.DataAccessException;

/**
* NJdbcException.
*
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
@SuppressWarnings("all")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package com.alibaba.nacos.config.server.exception;

/**
* NacosConfigException.
*
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
public class NacosConfigException extends RuntimeException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

/**
* If the embedded distributed storage is enabled, all requests are routed to the Leader node for processing, and the
* maximum number of forwards for a single request cannot exceed three
* maximum number of forwards for a single request cannot exceed three.
*
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@
import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;

/**
* encode filter
* Web encode filter.
*
* @author Nacos
*/
public class NacosWebFilter implements Filter {

static private String webRootPath;
private static String webRootPath;

static public String rootPath() {
public static String rootPath() {
return webRootPath;
}

/**
* 方便测试
* Easy for testing.
*
* @param path web path
* @param path web path.
*/
static public void setWebRootPath(String path) {
public static void setWebRootPath(String path) {
webRootPath = path;
}

Expand All @@ -74,5 +74,4 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
@Override
public void destroy() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@
package com.alibaba.nacos.config.server.manager;

/**
* task manage
* AbstractTask.
*
* @author huali
*/
public abstract class AbstractTask {

/**
* 一个任务两次处理的间隔,单位是毫秒
* Task time interval between twice processing, unit is millisecond.
*/
private long taskInterval;

/**
* 任务上次被处理的时间,用毫秒表示
* The time which was processed at last time, unit is millisecond.
*/
private long lastProcessTime;

/**
* merge task
* merge task.
*
* @param task task
*/
Expand All @@ -57,9 +57,9 @@ public long getLastProcessTime() {
}

/**
* TaskManager 判断当前是否需要处理这个Task,子类可以Override这个函数实现自己的逻辑
* TaskManager judge whether to process current this task, subclass could override and implement the logical codes.
*
* @return
* @return the result whether to process.
*/
public boolean shouldProcess() {
return (System.currentTimeMillis() - this.lastProcessTime >= this.taskInterval);
Expand Down
Loading

0 comments on commit 9966ec3

Please sign in to comment.