⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tomcatwait.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
//////                                   ____.//                       __/\ ______|    |__/\.     _______//            __   .____|    |       \   |    +----+       \//    _______|  /--|    |    |    -   \  _    |    :    -   \_________//   \\______: :---|    :    :           |    :    |         \________>//           |__\---\_____________:______:    :____|____:_____\//                                      /_____|////              . . . i n   j a h i a   w e   t r u s t . . .//package org.jahia.init;import java.io.InputStream;import java.io.PrintStream;import java.net.URL;/** * <p>Title: Tomcat waiting utility</p> * <p>Description: Small standalone utility to wait until the Tomcat web server * has finished initializing before going on with the startup script.</p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author Serge Huber * @version 1.0 */public class TomcatWait{    private static final String DEFAULT_TARGET_URL = "http://localhost:8080/jahia/html/startup/startjahia.html";    public static void main(String args[])    {        String targetURL = DEFAULT_TARGET_URL;        if (args.length == 0) {            System.out.println("Missing targetURL, defaulting to " + DEFAULT_TARGET_URL);        } else {            targetURL = args[0];        }        URL url = null;        try        {            url = new URL(targetURL);        }        catch(Throwable throwable)        {            System.out.println("Error in URL parameter : " + targetURL);            throwable.printStackTrace();            return;        }        boolean flag = false;        System.out.print("Waiting for Web Server to become available at " + targetURL + ".");        try {            Thread.sleep(1000); // sleep 1 second before making the connection        } catch (InterruptedException ie) {            ie.printStackTrace();        }        while(!flag) {            System.out.print(".");            try {                Thread.sleep(500); // sleep 500 ms between tries.            } catch (InterruptedException ie) {                ie.printStackTrace();            }            try            {                InputStream inputstream = url.openStream();                flag = true;                inputstream.close();            }            catch(Throwable throwable1)            {                flag = false;            }        }        System.out.println("");        System.out.println("Web Server now available.");    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -