@@ -813,7 +813,7 @@ public void insertAppIfNotExits(String domain, String app) throws SQLException {
813
813
public List <MonitorApp > listApp (String domain ) throws SQLException {
814
814
List <MonitorApp > list = new ArrayList <MonitorApp >();
815
815
816
- String sql = "select id, domain, app from druid_app " //
816
+ String sql = "select id, domain, app from druid_app "
817
817
+ " where domain = ?" ;
818
818
Connection conn = null ;
819
819
PreparedStatement stmt = null ;
@@ -838,7 +838,7 @@ public List<MonitorApp> listApp(String domain) throws SQLException {
838
838
}
839
839
840
840
public MonitorApp findApp (String domain , String app ) throws SQLException {
841
- String sql = "select id, domain, app from druid_app " //
841
+ String sql = "select id, domain, app from druid_app "
842
842
+ " where domain = ? and app = ?" ;
843
843
Connection conn = null ;
844
844
PreparedStatement stmt = null ;
@@ -876,7 +876,7 @@ private MonitorApp readApp(ResultSet rs) throws SQLException {
876
876
public List <MonitorCluster > listCluster (String domain , String app ) throws SQLException {
877
877
List <MonitorCluster > list = new ArrayList <MonitorCluster >();
878
878
879
- String sql = "select id, domain, app, cluster from druid_cluster " //
879
+ String sql = "select id, domain, app, cluster from druid_cluster "
880
880
+ " where domain = ?" ;
881
881
882
882
if (app != null ) {
@@ -919,7 +919,7 @@ public void insertClusterIfNotExits(String domain, String app, String cluster) t
919
919
}
920
920
921
921
public MonitorCluster findCluster (String domain , String app , String cluster ) throws SQLException {
922
- String sql = "select id, domain, app, cluster from druid_cluster " //
922
+ String sql = "select id, domain, app, cluster from druid_cluster "
923
923
+ " where domain = ? and app = ? and cluster = ?" ;
924
924
Connection conn = null ;
925
925
PreparedStatement stmt = null ;
@@ -960,19 +960,19 @@ public void insertOrUpdateInstance(String domain, String app, String cluster, St
960
960
Date startTime , long pid ) throws SQLException {
961
961
MonitorInstance monitorInst = findInst (domain , app , cluster , host );
962
962
if (monitorInst == null ) {
963
- String sql = "insert into druid_inst (domain, app, cluster, host, ip, lastActiveTime, lastPID) " //
963
+ String sql = "insert into druid_inst (domain, app, cluster, host, ip, lastActiveTime, lastPID) "
964
964
+ " values (?, ?, ?, ?, ?, ?, ?)" ;
965
965
JdbcUtils .execute (dataSource , sql , domain , app , cluster , host , ip , startTime , pid );
966
966
} else {
967
- String sql = "update druid_inst set ip = ?, lastActiveTime = ?, lastPID = ? " //
967
+ String sql = "update druid_inst set ip = ?, lastActiveTime = ?, lastPID = ? "
968
968
+ " where domain = ? and app = ? and cluster = ? and host = ? " ;
969
969
JdbcUtils .execute (dataSource , sql , ip , startTime , pid , domain , app , cluster , host );
970
970
}
971
971
}
972
972
973
973
public MonitorInstance findInst (String domain , String app , String cluster , String host ) throws SQLException {
974
- String sql = "select id, domain, app, cluster, host, ip, lastActiveTime, lastPID from druid_inst " //
975
- + " where domain = ? and app = ? and cluster = ? and host = ? " //
974
+ String sql = "select id, domain, app, cluster, host, ip, lastActiveTime, lastPID from druid_inst "
975
+ + " where domain = ? and app = ? and cluster = ? and host = ? "
976
976
+ " limit 1" ;
977
977
Connection conn = null ;
978
978
PreparedStatement stmt = null ;
@@ -1002,7 +1002,7 @@ public MonitorInstance findInst(String domain, String app, String cluster, Strin
1002
1002
public List <MonitorInstance > listInst (String domain , String app , String cluster ) throws SQLException {
1003
1003
List <MonitorInstance > list = new ArrayList <MonitorInstance >();
1004
1004
1005
- String sql = "select id, domain, app, cluster, host, ip, lastActiveTime, lastPID from druid_inst " //
1005
+ String sql = "select id, domain, app, cluster, host, ip, lastActiveTime, lastPID from druid_inst "
1006
1006
+ "where domain = ?" ;
1007
1007
1008
1008
if (app != null ) {
0 commit comments