📄 org_apache_catalina_startup_catalina--rosonsandy.htm
字号:
(server instanceof Lifecycle)
{<BR> try
{<BR>
try
{<BR>
// Remove the ShutdownHook first so that server.stop()
<BR>
// doesn't get invoked
twice<BR>
Runtime.getRuntime().removeShutdownHook(shutdownHook);<BR>
} catch (Throwable t)
{<BR>
// This will fail on JDK 1.2. Ignoring, as Tomcat can
run<BR>
// fine without the shutdown
hook.<BR>
}<BR></FONT><FONT
style="BACKGROUND-COLOR: #ffffff">
((Lifecycle)
server).stop();<BR>
} catch (LifecycleException e)
{<BR>
System.out.println("Catalina.stop: " +
e);<BR>
e.printStackTrace(System.out);<BR>
if (e.getThrowable() != null)
{<BR>
System.out.println("----- Root Cause
-----");<BR>
e.getThrowable().printStackTrace(System.out);<BR>
}<BR>
}<BR> }</FONT></P>
<P><FONT style="BACKGROUND-COLOR: #ffffff"> }</FONT></P>
<P><BR> /**<BR> * Stop an existing
server instance.<BR> */<BR>
protected void stop() {</P>
<P> // Create and execute our
Digester<BR> Digester digester =
createStopDigester();<BR> File file
= configFile();<BR> try
{<BR>
InputSource is
=<BR>
new InputSource("file://" +
file.getAbsolutePath());<BR>
FileInputStream fis = new
FileInputStream(file);<BR>
is.setByteStream(fis);<BR>
digester.push(this);<BR>
digester.parse(is);<BR>
fis.close();<BR> } catch (Exception
e) {<BR>
System.out.println("Catalina.stop: " +
e);<BR>
e.printStackTrace(System.out);<BR>
System.exit(1);<BR> }</P>
<P> // Stop the existing
server<BR> try
{<BR> Socket socket =
new Socket("127.0.0.1",
server.getPort());<BR>
OutputStream stream =
socket.getOutputStream();<BR>
String shutdown =
server.getShutdown();<BR>
for (int i = 0; i < shutdown.length();
i++)<BR>
stream.write(shutdown.charAt(i));<BR>
stream.flush();<BR>
stream.close();<BR>
socket.close();<BR> } catch (IOException e)
{<BR>
System.out.println("Catalina.stop: " +
e);<BR>
e.printStackTrace(System.out);<BR>
System.exit(1);<BR> }</P>
<P><BR> }</P>
<P><BR> /**<BR> * Print usage
information for this application.<BR>
*/<BR> protected void usage() {</P>
<P>
System.out.println<BR>
("usage: java
org.apache.catalina.startup.Catalina"<BR>
+ " [ -config {pathname} ] [ -debug
]"<BR>
+ " [ -nonaming ] { start | stop }");</P>
<P> }</P>
<P><BR> // ---------------------------------------
CatalinaShutdownHook Inner Class</P>
<P><BR> /**<BR> * Shutdown hook
which will perform a clean shutdown of Catalina if
needed.<BR> */<BR> protected class
CatalinaShutdownHook extends Thread {</P>
<P> public void run() {</P>
<P> if
(server != null)
{<BR>
try
{<BR>
((Lifecycle)
server).stop();<BR>
} catch (LifecycleException e)
{<BR>
System.out.println("Catalina.stop: " +
e);<BR>
e.printStackTrace(System.out);<BR>
if (e.getThrowable() != null)
{<BR>
System.out.println("----- Root Cause
-----");<BR>
e.getThrowable().printStackTrace(System.out);<BR>
}<BR>
}<BR>
}<BR>
<BR> }</P>
<P> }<BR>}</P>
<P><BR>// ------------------------------------------------------------ Private
Classes</P>
<P><BR>/**<BR> * Rule that sets the parent class loader for the top
object on the stack,<BR> * which must be a
<CODE>Container</CODE>.<BR> */</P>
<P>final class SetParentClassLoaderRule extends Rule {</P>
<P> public SetParentClassLoaderRule(Digester
digester,<BR>
ClassLoader parentClassLoader) {</P>
<P>
super(digester);<BR>
this.parentClassLoader = parentClassLoader;</P>
<P> }</P>
<P> ClassLoader parentClassLoader = null;</P>
<P> public void begin(Attributes attributes) throws
Exception {</P>
<P> if (digester.getDebug() >=
1)<BR>
digester.log("Setting parent class loader");</P>
<P> Container top = (Container)
digester.peek();<BR>
top.setParentClassLoader(parentClassLoader);</P>
<P> }<BR>}<BR></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left>
<P> </P></LI></UL>
<P></P>
<P class=diaryFoot>- 作者: <A
onclick="window.open('http://publishblog.blogdriver.com/blog/postMessage.b?receiver=517836','发送短消息','width=520, height=455')"
href="javascript:void(0);">rosonsandy</A> 2005年08月8日, 星期一 14:23 </P></DIV>
<DIV class=operation><A name=trackback>
<H3>Trackback</H3></A>
<P class=trackback>你可以使用这个链接引用该篇日志
http://publishblog.blogdriver.com/blog/tb.b?diaryID=879651 </P></DIV>
<DIV class=operation><A name=comment>
<H3>回复</H3></A></DIV>
<DIV class=operation>
<TABLE class=comment cellSpacing=0 cellPadding=0 width=700 border=0>
<FORM id=replyForm method=post><INPUT type=hidden value=356891 name=blogID>
<INPUT type=hidden value=879651 name=diaryID> <INPUT type=hidden
value=rosonsandy name=blogDomino>
<SCRIPT>
if(getCookie('userID') == null){
document.write('<tr><td width="70">发布人:</td>');
document.write('<td width="150"> <input name="remark.authorNameFUI" type="text" size="20" class="inputStyle" maxlength="20"></td>');
document.write('<td width="70">邮箱:</td>');
document.write('<td width="435"> <input name="remark.authorEmail" type="text" size="20" class="inputStyle" maxlength="40"></td>');
document.write('</tr><tr><td>主 页:</td>');
document.write('<td colspan="3"> <input name="remark.authorURL" type="text" class="inputStyle" value="HTTP://" size="63" maxlength="40"></td></tr>');
}else{
document.write('<input type="hidden" name="remark.authorNameFUI" value="Blogdriver">');
}
</SCRIPT>
<TBODY>
<TR align=left>
<TD colSpan=4>评论内容:<BR><TEXTAREA class=textStyle id=remark name=remark.remarkFUI rows=8 cols=60> </TEXTAREA>
</TD></TR>
<TR align=left>
<TD colSpan=4> <INPUT onclick=reply() type=button value=提交>
<INPUT type=reset value=重置> </TD></TR></FORM></TBODY></TABLE></DIV></DIV>
<
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -