Explorar el Código

sql线程修改,数据源判断改成只取第一条

chenweida hace 9 años
padre
commit
32803682b3

+ 7 - 5
Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/thread/UpdateThread.java

@ -201,9 +201,9 @@ public class UpdateThread implements Runnable {
        try {
            String system = System.getProperty("os.name").toLowerCase();
            if (system.contains("windows")) {
                LogUtil.info("启动windows服务");
                //windows
                String batPathStart = UpdateThread.class.getResource("/").getPath() + "config/start.bat";
                LogUtil.info("启动windows服务:" + batPathStart);
                //windows
                Process psStart = Runtime.getRuntime().exec(batPathStart);
                ByteArrayOutputStream baosStart = new ByteArrayOutputStream();
                InputStream osStart = psStart.getInputStream();
@ -213,8 +213,9 @@ public class UpdateThread implements Runnable {
                }
                osStart.close();
                baosStart.close();
                int i = 0;
                LogUtil.info("开始判断服务是否启动");
                while (true) {
                    int i = 0;
                    String batPath = UpdateThread.class.getResource("/").getPath() + "config/serviceAlive.bat";
                    Process ps = Runtime.getRuntime().exec(batPath);
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
@ -225,13 +226,13 @@ public class UpdateThread implements Runnable {
                    String s = baos.toString();
                    os.close();
                    baos.close();
                    LogUtil.info("服务正在启动:" + Boolean.valueOf(s.trim()));
                    if (Boolean.valueOf(s.trim())) {
                        i++;
                        if (i > 3) {
                            LogUtil.info("服务启动成功");
                            break;
                        }
                        LogUtil.info("第" + i + "次判断服务已经启动");
                        Thread.sleep(1000L);
                    }
                }
            } else {
@ -373,6 +374,7 @@ public class UpdateThread implements Runnable {
    public static void main(String[] args) throws Exception {
        while (true) {
            String batPath = UpdateThread.class.getResource("/").getPath() + "config/serviceAlive.bat";
            System.out.println(batPath);
            Process ps = Runtime.getRuntime().exec(batPath);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            InputStream os = ps.getInputStream();

+ 1 - 1
Hos-Resource-Mini-Update/src/main/resources/config/serviceAlive.bat

@ -1,5 +1,5 @@
@echo off
for /f "skip=3 tokens=4" %%i in ('sc query tomcat8-esb-ds') do set "zt=%%i" &goto :next
for /f "skip=3 tokens=4" %%i in ('sc query tomcat8-esb-ds ') do set "zt=%%i" &goto :next
:next
if /i "%zt%"=="RUNNING" (
    echo true