当前位置: 首页>>代码示例>>Java>>正文


Java LifecycleState.STOPPED属性代码示例

本文整理汇总了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();
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:TomcatBaseTest.java

示例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();
    }
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:13,代码来源:RegistryTest.java

示例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());
	}
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:17,代码来源:AbstractRecommenderRestTest.java

示例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());
	}
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:17,代码来源:TomcatTestHandler.java

示例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();
    }
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:13,代码来源:AbstractStoreRestTest.java

示例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();
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:15,代码来源:HeartbeatTest.java

示例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();
    }
}
 
开发者ID:nlighten,项目名称:tomcat_exporter,代码行数:9,代码来源:AbstractTomcatMetricsTest.java

示例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();
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:59,代码来源:LifecycleBase.java

示例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();
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:60,代码来源:LifecycleBase.java


注:本文中的org.apache.catalina.LifecycleState.STOPPED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。