vernedeng commented on code in PR #9927: URL: https://github.com/apache/inlong/pull/9927#discussion_r1554826278
########## inlong-audit/audit-service/src/main/java/elector/api/ElectorConfig.java: ########## @@ -0,0 +1,77 @@ +/* + * 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 elector.api; + +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.net.InetAddress; + +/** + * Elector config + */ +@Data +public class ElectorConfig { + + public static final String MONITOR_COMMON_NAME = "audit"; + private final String serviceId; + private final String leaderId; + private String defaultLeaderId; + private boolean useDefaultLeader = false; + private String dbDriver; + private String dbUrl; + private String dbUser; + private String dbPasswd; + private String electorDbName = "leader_election"; + private int leaderTimeout = 20; + private int tryToBeLeaderInterval = 5; + private int dbMonitorRunInterval = 20; + private int connectionTimeout = 10000; + private int idleTimeout = 60000; + private int maxLifetime = 1800000; + private int maximumPoolSize = 2; + private String cachePrepStmts = "true"; + private int prepStmtCacheSize = 250; + private int prepStmtCacheSqlLimit = 2048; + private String monitorName = "elector_leader_state"; + private String ip; + private ElectorChangeListener electorChangeListener; + + public ElectorConfig(String serviceId, String leaderId, String dbUrl, String dbUser, String dbPasswd, + String dbDriver) { + this.serviceId = serviceId; Review Comment: Need null value check Precondition.notnull() -- 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]
