diff --git a/WebContent/WEB-INF/config/spring-applicationContext.xml b/WebContent/WEB-INF/config/spring-applicationContext.xml index 33ffe0a4..4f59451f 100644 --- a/WebContent/WEB-INF/config/spring-applicationContext.xml +++ b/WebContent/WEB-INF/config/spring-applicationContext.xml @@ -10,13 +10,20 @@ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + http://www.springframework.org/schema/context/spring-context-3.0.xsd + http://www.springframework.org/schema/websocket + http://www.springframework.org/schema/websocket/spring-websocket.xsd"> + + + + @@ -26,11 +33,11 @@ - + - + @@ -42,7 +49,7 @@ - + diff --git a/WebContent/WEB-INF/config/springmvc-applicationContext.xml b/WebContent/WEB-INF/config/springmvc-applicationContext.xml index 2d119a71..25517806 100644 --- a/WebContent/WEB-INF/config/springmvc-applicationContext.xml +++ b/WebContent/WEB-INF/config/springmvc-applicationContext.xml @@ -1,16 +1,37 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:mvc="http://www.springframework.org/schema/mvc" + xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:websocket="http://www.springframework.org/schema/websocket" + xsi:schemaLocation=" + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-4.0.xsd + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-4.0.xsd + http://www.springframework.org/schema/jdbc + http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd + http://www.springframework.org/schema/tx + http://www.springframework.org/schema/tx/spring-tx-4.0.xsd + http://www.springframework.org/schema/aop + http://www.springframework.org/schema/aop/spring-aop-4.0.xsd + http://www.springframework.org/schema/mvc + http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd + http://www.springframework.org/schema/websocket + http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd" + default-autowire="byName"> - + + + + + alliveTask = new Hashtable(); - public final static int EXEC_TIME = 10;// 连接多少次后不成功,取消链接 + public final static int EXEC_TIME = 9;// 连接多少次后不成功,取消链接 public final static long INTERVAL_TIME = 60 * 1000;// 每隔多少毫秒执行一次连接任务 public final static long DELAY_TIME = 0; // 延迟多少秒后执行 @@ -96,12 +96,11 @@ public class OracleStatusService { private int count; private OracleConnectorParams ocp; private SimpleKubeClient client; - public connectTask(OracleConnectorParams ocp, SimpleKubeClient client) { this.taskName = ocp.getName(); this.ocp = ocp; this.count = 0; - this.client = client; + this.client = client; } @Override @@ -109,9 +108,12 @@ public class OracleStatusService { if (count == EXEC_TIME && alliveTask.containsKey(taskName)) { killAlliveTask(taskName); client.updateOrAddReplicasLabelById(taskName, "status", "1"); + Configs.CONSOLE_LOGGER.info("更新replicationController标签: " + taskName + + "\t[标签更新为: 失败]"); } else { String url = "jdbc:oracle:thin:@" + ocp.getIp() + ":" - + ocp.getPort() + "/" + ocp.getDatabaseName(); + + ocp.getPort() + ":" + ocp.getDatabaseName(); + System.out.println("url:" + url +",user:" + ocp.getUser() + ",password:" + ocp.getPassword()); boolean flag = OracleConnector.canConnect(url, ocp.getUser(), ocp.getPassword()); String message = "失败"; @@ -119,6 +121,8 @@ public class OracleStatusService { client.updateOrAddReplicasLabelById(taskName, "status", "2"); message = "成功"; killAlliveTask(taskName); // 连接成功,取消连接 + Configs.CONSOLE_LOGGER.info("更新replicationController标签: " + taskName + + "\t[标签更新为: 成功]"); } Configs.CONSOLE_LOGGER.info("连接到数据库服务: " + taskName + "\t[连接结果: " + message + "]");