From acd377cc4d0f2d941241b360526b069aad952c2f Mon Sep 17 00:00:00 2001
From: wu ming <569287825@qq.com>
Date: Wed, 14 Sep 2016 13:56:45 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=AF=E5=8A=A8oracle?=
=?UTF-8?q?=EF=BC=8C=E6=B5=8B=E8=AF=95=E8=BF=9E=E6=8E=A5oracle=E5=A4=B1?=
=?UTF-8?q?=E8=B4=A5=E7=9A=84Bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../config/spring-applicationContext.xml | 15 +++++---
.../config/springmvc-applicationContext.xml | 35 +++++++++++++++----
.../entities/OracleConnectorParams.java | 4 +--
src/com/platform/oracle/OracleConnector.java | 19 +++++-----
.../platform/service/OracleStatusService.java | 12 ++++---
5 files changed, 57 insertions(+), 28 deletions(-)
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 + "]");