diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProjectService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProjectService.java index c305890703..1196bf55ce 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProjectService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProjectService.java @@ -117,8 +117,6 @@ public class ProjectService extends BaseService{ /** * check project and authorization - * 检查项目权限 - * * @param loginUser * @param project * @param projectName @@ -155,8 +153,6 @@ public class ProjectService extends BaseService{ /** * admin can view all projects - * 如果是管理员,则所有项目都可见 - * * @param loginUser * @param pageSize * @param pageNo diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java index e870792592..c5b9f60b3a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java @@ -108,7 +108,6 @@ public class ResourcesService extends BaseService { if (!StringUtils.equals(fileSuffix, nameSuffix)) { /** * rename file suffix and original suffix must be consistent - * 重命名的后缀必须与原文件后缀一致 */ logger.error("rename file suffix and original suffix must be consistent: {}", file.getOriginalFilename()); putMsg(result, Status.RESOURCE_SUFFIX_FORBID_CHANGE); diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/queue/TaskQueueZkImpl.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/queue/TaskQueueZkImpl.java index bc24d5ddad..76d88868f2 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/queue/TaskQueueZkImpl.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/queue/TaskQueueZkImpl.java @@ -137,7 +137,6 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue { * ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskId}_host1,host2,... * The tasks with the highest priority are selected by comparing the priorities of the above four levels from high to low. * - * 流程优先级_流程实例id_任务优先级_任务id_任务执行的机器id1,任务执行的机器id2,... high <- low * @param key task queue name * @param tasksNum how many elements to poll * @return the task ids to be executed diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java index 7f7ce30d08..a12e810dfd 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java @@ -214,8 +214,7 @@ public class JSONUtils { } /** - * 对象装json字符串

- * + * object to json string * @return json string */ public static String toJsonString(Object object) { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SchemaUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SchemaUtils.java index 4d0621beeb..fbca720b30 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SchemaUtils.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SchemaUtils.java @@ -41,7 +41,6 @@ public class SchemaUtils { private static Pattern p = Pattern.compile("\\s*|\t|\r|\n"); /** - * 获取所有upgrade目录下的可升级的schema * Gets upgradable schemas for all upgrade directories * @return */ @@ -86,7 +85,6 @@ public class SchemaUtils { } /** - * 判断schemaVersion是否比version版本高 * Determine whether schemaVersion is higher than version * @param schemaVersion * @param version @@ -108,7 +106,6 @@ public class SchemaUtils { } } - // 说明直到第arrLength-1个元素,两个版本号都一样,此时谁的arrLength大,谁的版本号就大 // If the version and schema version is the same from 0 up to the arrlength-1 element,whoever has a larger arrLength has a larger version number return schemaVersionArr.length > versionArr.length; } @@ -133,7 +130,6 @@ public class SchemaUtils { } /** - * 去掉字符串中的空格回车换行和制表符 * Strips the string of space carriage returns and tabs * @param str * @return diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ScriptRunner.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ScriptRunner.java index f30b20f6b2..730b6819c9 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ScriptRunner.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ScriptRunner.java @@ -167,9 +167,6 @@ public class ScriptRunner { command.append(line.substring(0, line.lastIndexOf(getDelimiter()))); command.append(" "); Statement statement = conn.createStatement(); - - // logger.info(command.toString()); - boolean hasResults = false; logger.info("sql:"+command.toString()); if (stopOnError) { @@ -253,11 +250,9 @@ public class ScriptRunner { command.append(" "); Statement statement = conn.createStatement(); - // logger.info(command.toString()); - sql = command.toString().replaceAll("\\{\\{APPDB\\}\\}", dbName); boolean hasResults = false; - logger.info("sql:"+sql); + logger.info("sql : " + sql); if (stopOnError) { hasResults = statement.execute(sql); } else { diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/JSONUtilsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/JSONUtilsTest.java index a7af13191d..799874ad71 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/JSONUtilsTest.java +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/JSONUtilsTest.java @@ -67,21 +67,21 @@ public class JSONUtilsTest { LinkedHashMap.class); Assert.assertEquals(maps.size(), 1); - Assert.assertEquals(maps.get(0).get("mysql服务名称"), "mysql200"); - Assert.assertEquals(maps.get(0).get("mysql地址"), "192.168.xx.xx"); - Assert.assertEquals(maps.get(0).get("端口"), "3306"); - Assert.assertEquals(maps.get(0).get("期间内没有使用索引的查询数握"), "80"); - Assert.assertEquals(maps.get(0).get("数据库客户端连接数"), "190"); + Assert.assertEquals(maps.get(0).get("mysql service name"), "mysql200"); + Assert.assertEquals(maps.get(0).get("mysql address"), "192.168.xx.xx"); + Assert.assertEquals(maps.get(0).get("port"), "3306"); + Assert.assertEquals(maps.get(0).get("no index of number"), "80"); + Assert.assertEquals(maps.get(0).get("database client connections"), "190"); } public String list2String(){ LinkedHashMap map1 = new LinkedHashMap<>(); - map1.put("mysql服务名称","mysql200"); - map1.put("mysql地址","192.168.xx.xx"); - map1.put("端口","3306"); - map1.put("期间内没有使用索引的查询数握","80"); - map1.put("数据库客户端连接数","190"); + map1.put("mysql service name","mysql200"); + map1.put("mysql address","192.168.xx.xx"); + map1.put("port","3306"); + map1.put("no index of number","80"); + map1.put("database client connections","190"); List> maps = new ArrayList<>(); maps.add(0,map1); diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/ProcessDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/ProcessDao.java index 1490eef4e4..aff849eda1 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/ProcessDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/ProcessDao.java @@ -247,7 +247,7 @@ public class ProcessDao extends AbstractBaseDao { int processInstanceId = cmdParamObj.getInteger(CMDPARAM_RECOVER_PROCESS_ID_STRING); List commands = commandMapper.selectList(null); - //遍历所有命令 + // for all commands for (Command tmpCommand:commands){ if(cmdTypeMap.containsKey(tmpCommand.getCommandType())){ tempObj = (JSONObject) JSONObject.parse(tmpCommand.getCommandParam()); @@ -637,7 +637,7 @@ public class ProcessDao extends AbstractBaseDao { ExecutionStatus.KILL); suspendedNodeList.addAll(stopNodeList); for(Integer taskId : suspendedNodeList){ - // 把暂停状态初始化 + // initialize the pause state initTaskInstance(this.findTaskInstanceById(taskId)); } cmdParam.put(Constants.CMDPARAM_RECOVERY_START_NODE_STRING, String.join(",", convertIntListToString(suspendedNodeList))); @@ -1561,7 +1561,7 @@ public class ProcessDao extends AbstractBaseDao { * * @param masterId * @param processDefinitionId - * @param scheduledFireTime 任务调度预计触发的时间 + * @param scheduledFireTime the time the task schedule is expected to trigger * @return * @throws Exception */ @@ -1576,7 +1576,7 @@ public class ProcessDao extends AbstractBaseDao { * get dependency cycle list by work process define id list and scheduler fire time * @param masterId * @param ids - * @param scheduledFireTime 任务调度预计触发的时间 + * @param scheduledFireTime the time the task schedule is expected to trigger * @return * @throws Exception */ @@ -1597,7 +1597,7 @@ public class ProcessDao extends AbstractBaseDao { Cron depCron; List list; List schedules = this.selectAllByProcessDefineId(ids); - // for all scheduling info + // for all scheduling information for(Schedule depSchedule:schedules){ strCrontab = depSchedule.getCrontab(); depCronExpression = CronUtils.parse2CronExpression(strCrontab); diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java index 8949730b74..a722dbaa3f 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java @@ -77,7 +77,7 @@ public class TaskRecordDao { String password = conf.getString(Constants.TASK_RECORD_PWD); Connection conn = null; try { - //classLoader,加载对应驱动 + //classLoader,load driver Class.forName(driver); conn = DriverManager.getConnection(url, username, password); } catch (ClassNotFoundException e) { diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/cron/CronUtilsTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/cron/CronUtilsTest.java index 86227e348f..edc7cfcbdc 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/cron/CronUtilsTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/cron/CronUtilsTest.java @@ -52,7 +52,7 @@ public class CronUtilsTest { .withSecond(on(0)) .instance(); // Obtain the string expression - String cronAsString = cron.asString(); // 0 */5 * * * ? * Every five minutes(每5分钟一次) + String cronAsString = cron.asString(); // 0 */5 * * * ? * Every five minutes(once every 5 minutes) Assert.assertEquals(cronAsString, "0 */5 * * * ? *"); @@ -103,7 +103,7 @@ public class CronUtilsTest { .withSecond(on(0)) .instance(); - String cronAsString = cron1.asString(); // 0 */5 * * * ? * 每5分钟一次 + String cronAsString = cron1.asString(); // 0 */5 * * * ? * once every 5 minutes //logger.info(cronAsString); // Obtain the string expression //String minCrontab = "0 0 * * * ? *"; @@ -113,13 +113,13 @@ public class CronUtilsTest { //String minCrontab = "* 0,3 2 SUN * 1#1 *"; //String minCrontab = "* 0,3 * 1W * ? *"; //cron = CronUtils.parse2Cron("0 * * * * ? *"); - // 月份周期 + // month cycle /*String[] cronArayy = new String[]{"* 0,3 * 1W * ? *","* 0 0 1W * ? *", "0 0 0 L 3/5 ? *","0 0 0 ? 3/5 2/2 *"};*/ - // 分钟周期 + // minute cycle String[] cronArayy = new String[]{"* * * * * ? *","* 0 * * * ? *", "* 5 * * 3/5 ? *","0 0 * * * ? *"}; - // 周周期 + // week cycle /*String[] cronArayy = new String[]{"* * * ? * 2/1 *","0 *//*5 * ? * 2/1 *", "* * *//*5 ? * 2/1 *"};*/ for(String minCrontab:cronArayy){ @@ -164,9 +164,7 @@ public class CronUtilsTest { logger.info("dayOfWeekField instanceof And:"+(dayOfWeekField.getExpression() instanceof And)); logger.info("dayOfWeekField instanceof QuestionMark:"+(dayOfWeekField.getExpression() instanceof QuestionMark)); - CronField yearField = cron.retrieve(CronFieldName.YEAR); - //CycleEnum cycleEnum = CronUtils.getMaxCycle("0 * * * * ? *"); CycleEnum cycleEnum = CronUtils.getMaxCycle(minCrontab); if(cycleEnum !=null){ logger.info(cycleEnum.name()); diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/quartz/DruidConnectionProvider.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/quartz/DruidConnectionProvider.java index c328596761..c4f9740564 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/quartz/DruidConnectionProvider.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/quartz/DruidConnectionProvider.java @@ -98,12 +98,17 @@ public class DruidConnectionProvider implements ConnectionProvider { */ private DruidDataSource datasource; + @Override public Connection getConnection() throws SQLException { return datasource.getConnection(); } + + @Override public void shutdown() throws SQLException { datasource.close(); } + + @Override public void initialize() throws SQLException{ if (this.URL == null) { throw new SQLException("DBPool could not be created: DB URL cannot be null"); @@ -132,10 +137,11 @@ public class DruidConnectionProvider implements ConnectionProvider { datasource.setMaxPoolPreparedStatementPerConnectionSize(DEFAULT_DB_MAX_CONNECTIONS); if (this.validationQuery != null) { datasource.setValidationQuery(this.validationQuery); - if(!this.validateOnCheckout) + if(!this.validateOnCheckout){ datasource.setTestOnReturn(true); - else + } else { datasource.setTestOnBorrow(true); + } datasource.setValidationQueryTimeout(this.idleConnectionValidationSeconds); } } diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java index fdc6eddba8..4dde369d8d 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java @@ -138,6 +138,7 @@ public class ZKMasterClient extends AbstractZKClient { } } + @Override public void close(){ try { if(masterPathChildrenCache != null){ diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKWorkerClient.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKWorkerClient.java index df6575bcb1..d161d33783 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKWorkerClient.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKWorkerClient.java @@ -75,6 +75,7 @@ public class ZKWorkerClient extends AbstractZKClient { this.registWorker(); } + @Override public void close(){ try { if(workerPathChildrenCache != null){