Java Catalina 6.x在8.x中启动和停止bacome决赛
我已经重写了LifecycleBase.start()方法,如下所示。但在Catalina 8.x中,这种方法已成为最终方法。 谁能告诉我怎么解决这个问题吗。 这是源代码Java Catalina 6.x在8.x中启动和停止bacome决赛,java,catalina,Java,Catalina,我已经重写了LifecycleBase.start()方法,如下所示。但在Catalina 8.x中,这种方法已成为最终方法。 谁能告诉我怎么解决这个问题吗。 这是源代码 public void start() throws LifecycleException { super.start(); if(condition) { File checkDataFile = new File(DataFilePath); if(
public void start() throws LifecycleException
{
super.start();
if(condition)
{
File checkDataFile = new File(DataFilePath);
if(containerLog.isDebugEnabled())
containerLog.debug("checking secureDataFile: " + checkDataFile.getAbsolutePath());
another code ...
}
else
{
throw new LifecycleException("illegal arguments");
}
}
public void stop() throws LifecycleException
{
// sync via realm-object -> so the stop-event has to wait for active threads finishing their operations
synchronized(this)
{
super.stop();
}
}
您可以使用and,这两种方法都受抽象保护
,分别由start()
和stop()
调用
当然,不要调用super.start()
和super.stop()
,否则您将遇到stackOverflowerError
,因为start()
和stop()
已经在调用自定义的“内部”方法
同时,从以下两种方法仔细阅读合同:
startInternal()
子类必须确保在执行期间将状态更改为org.apache.catalina.LifecycleState.STARTING
这个方法。更改状态将触发
org.apache.catalina.Lifecycle.START\u事件。如果组件出现故障
要启动它,可以抛出org.apache.catalina.LifecycleException
这将导致它的父级无法启动,或者它可以自行放置
处于错误状态,在这种情况下,将对失败的
但父组件将继续正常启动
及
stopInternal()
子类必须确保状态更改为
org.apache.catalina.LifecycleState.STOPPING
这个方法。更改状态将触发
org.apache.catalina.Lifecycle.STOP_事件
如果您想了解更多细节,请查看
的最新版本之一