本文整理汇总了Java中org.apache.catalina.LifecycleState.STOPPED属性的典型用法代码示例。如果您正苦于以下问题:Java LifecycleState.STOPPED属性的具体用法?Java LifecycleState.STOPPED怎么用?Java LifecycleState.STOPPED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.catalina.LifecycleState
的用法示例。
在下文中一共展示了LifecycleState.STOPPED属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tearDown
@After
@Override
public void tearDown() throws Exception {
try {
// Some tests may call tomcat.destroy(), some tests may just call
// tomcat.stop(), some not call either method. Make sure that stop()
// & destroy() are called as necessary.
if (tomcat.server != null
&& tomcat.server.getState() != LifecycleState.DESTROYED) {
if (tomcat.server.getState() != LifecycleState.STOPPED) {
tomcat.stop();
}
tomcat.destroy();
}
} finally {
super.tearDown();
}
}
示例2: dismantle
/**
* Dismantles the embedded Tomcat.
* @throws Throwable Throws uncaught throwables for test to fail.
*/
@After
public void dismantle() throws Throwable {
if (testTomcat.getServer() != null && testTomcat.getServer().getState() != LifecycleState.DESTROYED) {
if (testTomcat.getServer().getState() != LifecycleState.STOPPED) {
testTomcat.stop();
}
testTomcat.destroy();
}
}
示例3: dismantle
/**
* Dismantle Tomcat.
*/
@After
public void dismantle() {
try {
if (testTomcat.getServer() != null
&& testTomcat.getServer().getState() != LifecycleState.DESTROYED) {
if (testTomcat.getServer().getState() != LifecycleState.STOPPED) {
testTomcat.stop();
}
testTomcat.destroy();
}
} catch (LifecycleException e) {
System.out.println("Exception shutting down testing Tomcat: " + e.getMessage());
}
}
示例4: dismantle
/**
* Dismantle Tomcat with index.
* @param index The tomcat index.
*/
public void dismantle(int index) {
try {
if (tomcats[index].getServer() != null
&& tomcats[index].getServer().getState() != LifecycleState.DESTROYED) {
if (tomcats[index].getServer().getState() != LifecycleState.STOPPED) {
tomcats[index].stop();
}
tomcats[index].destroy();
}
} catch (LifecycleException e) {
System.out.println("Exception shutting down Testing Tomcat (this may happen a lot): " + e.getMessage());
}
}
示例5: dismantle
/**
* Dismantles the embedded Tomcat.
* @throws Throwable Throws uncaught throwables for test to fail.
*/
@After
public void dismantle() throws Throwable {
if (storeTomcat.getServer() != null && storeTomcat.getServer().getState() != LifecycleState.DESTROYED) {
if (storeTomcat.getServer().getState() != LifecycleState.STOPPED) {
storeTomcat.stop();
}
storeTomcat.destroy();
}
}
示例6: dismantle
/**
* Dismantles the embedded Tomcat.
* @throws Throwable Throws uncaught throwables for test to fail.
*/
@After
public void dismantle() throws Throwable {
if (registryTomcat.getServer() != null && registryTomcat.getServer().getState() != LifecycleState.DESTROYED) {
if (registryTomcat.getServer().getState() != LifecycleState.STOPPED) {
registryTomcat.stop();
}
registryTomcat.destroy();
}
Registry.getRegistryInstance().getHeartbeatMap().clear();
Registry.getRegistryInstance().getMap().clear();
}
示例7: shutDownTomcat
public static void shutDownTomcat() throws LifecycleException {
if (tomcat.getServer() != null
&& tomcat.getServer().getState() != LifecycleState.DESTROYED) {
if (tomcat.getServer().getState() != LifecycleState.STOPPED) {
tomcat.stop();
}
tomcat.destroy();
}
}
示例8: stop
/**
* {@inheritDoc}
*/
@Override
public final synchronized void stop() throws LifecycleException {
if (LifecycleState.STOPPING_PREP.equals(state) || LifecycleState.STOPPING.equals(state) ||
LifecycleState.STOPPED.equals(state)) {
if (log.isDebugEnabled()) {
Exception e = new LifecycleException();
log.debug(sm.getString("lifecycleBase.alreadyStopped", toString()), e);
} else if (log.isInfoEnabled()) {
log.info(sm.getString("lifecycleBase.alreadyStopped", toString()));
}
return;
}
if (state.equals(LifecycleState.NEW)) {
state = LifecycleState.STOPPED;
return;
}
if (!state.equals(LifecycleState.STARTED) && !state.equals(LifecycleState.FAILED)) {
invalidTransition(Lifecycle.BEFORE_STOP_EVENT);
}
try {
if (state.equals(LifecycleState.FAILED)) {
// Don't transition to STOPPING_PREP as that would briefly mark the
// component as available but do ensure the BEFORE_STOP_EVENT is
// fired
fireLifecycleEvent(BEFORE_STOP_EVENT, null);
} else {
setStateInternal(LifecycleState.STOPPING_PREP, null, false);
}
stopInternal();
// Shouldn't be necessary but acts as a check that sub-classes are
// doing what they are supposed to.
if (!state.equals(LifecycleState.STOPPING) && !state.equals(LifecycleState.FAILED)) {
invalidTransition(Lifecycle.AFTER_STOP_EVENT);
}
setStateInternal(LifecycleState.STOPPED, null, false);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
setStateInternal(LifecycleState.FAILED, null, false);
throw new LifecycleException(sm.getString("lifecycleBase.stopFail",toString()), t);
} finally {
if (this instanceof Lifecycle.SingleUse) {
// Complete stop process first
setStateInternal(LifecycleState.STOPPED, null, false);
destroy();
}
}
}
示例9: stop
/**
* {@inheritDoc}
*/
@Override
public final synchronized void stop() throws LifecycleException {
if (LifecycleState.STOPPING_PREP.equals(state) || LifecycleState.STOPPING.equals(state)
|| LifecycleState.STOPPED.equals(state)) {
if (log.isDebugEnabled()) {
Exception e = new LifecycleException();
log.debug(sm.getString("lifecycleBase.alreadyStopped", toString()), e);
} else if (log.isInfoEnabled()) {
log.info(sm.getString("lifecycleBase.alreadyStopped", toString()));
}
return;
}
if (state.equals(LifecycleState.NEW)) {
state = LifecycleState.STOPPED;
return;
}
if (!state.equals(LifecycleState.STARTED) && !state.equals(LifecycleState.FAILED)) {
invalidTransition(Lifecycle.BEFORE_STOP_EVENT);
}
try {
if (state.equals(LifecycleState.FAILED)) {
// Don't transition to STOPPING_PREP as that would briefly mark
// the
// component as available but do ensure the BEFORE_STOP_EVENT is
// fired
fireLifecycleEvent(BEFORE_STOP_EVENT, null);
} else {
setStateInternal(LifecycleState.STOPPING_PREP, null, false);
}
stopInternal();
// Shouldn't be necessary but acts as a check that sub-classes are
// doing what they are supposed to.
if (!state.equals(LifecycleState.STOPPING) && !state.equals(LifecycleState.FAILED)) {
invalidTransition(Lifecycle.AFTER_STOP_EVENT);
}
setStateInternal(LifecycleState.STOPPED, null, false);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
setStateInternal(LifecycleState.FAILED, null, false);
throw new LifecycleException(sm.getString("lifecycleBase.stopFail", toString()), t);
} finally {
if (this instanceof Lifecycle.SingleUse) {
// Complete stop process first
setStateInternal(LifecycleState.STOPPED, null, false);
destroy();
}
}
}