Java 类org.apache.camel.spi.ShutdownStrategy 实例源码

项目:Camel    文件:EnricherSendEventTest.java   
protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ShutdownStrategy shutdownStrategy = camelContext.getShutdownStrategy();
    camelContext.addComponent("async", new MyAsyncComponent());

    shutdownStrategy.setTimeout(1000);
    shutdownStrategy.setTimeUnit(TimeUnit.MILLISECONDS);
    shutdownStrategy.setShutdownNowOnTimeout(true);


    ManagementStrategy managementStrategy = new DefaultManagementStrategy();
    managementStrategy.addEventNotifier(en);

    camelContext.setManagementStrategy(managementStrategy);
    return camelContext;
}
项目:microservice-mock    文件:MockMainListener.java   
/**
 * Auxiliary method to configure the shutdown strategy associated with the CamelContext. As result
 * it will not wait longer than 1 second for any in-flight messages to complete execution.
 *
 * @param camelContext
 *  The Camel context associated with the shutdown strategy.
 */
private void updateShutdownStrategy(CamelContext camelContext) {
    LOGGER.debug("Updating shutdown strategy for camel context: {}", camelContext.getName());
    ShutdownStrategy shutdownStrategy = camelContext.getShutdownStrategy();
    shutdownStrategy.setTimeUnit(TimeUnit.SECONDS);
    shutdownStrategy.setTimeout(1L);
    shutdownStrategy.setShutdownNowOnTimeout(true);
    shutdownStrategy.setSuppressLoggingOnTimeout(true);
}
项目:Camel    文件:EnricherAsyncUnhandledExceptionTest.java   
protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ShutdownStrategy shutdownStrategy = camelContext.getShutdownStrategy();
    camelContext.addComponent("async", new MyAsyncComponent());
    shutdownStrategy.setTimeout(1000);
    shutdownStrategy.setTimeUnit(TimeUnit.MILLISECONDS);
    shutdownStrategy.setShutdownNowOnTimeout(true);
    return camelContext;
}
项目:Camel    文件:DefaultCamelContext.java   
public ShutdownStrategy getShutdownStrategy() {
    return shutdownStrategy;
}
项目:Camel    文件:DefaultCamelContext.java   
public void setShutdownStrategy(ShutdownStrategy shutdownStrategy) {
    this.shutdownStrategy = shutdownStrategy;
}
项目:microservice-bundle    文件:ManagedCamelContext.java   
@Override
public ShutdownStrategy getShutdownStrategy() {
  return context.getShutdownStrategy();
}
项目:microservice-bundle    文件:ManagedCamelContext.java   
@Override
public void setShutdownStrategy(ShutdownStrategy shutdownStrategy) {
  context.setShutdownStrategy(shutdownStrategy);
}
项目:dropwizard-camel    文件:ManagedCamelContext.java   
@Override
public ShutdownStrategy getShutdownStrategy() {
    return context.getShutdownStrategy();
}
项目:dropwizard-camel    文件:ManagedCamelContext.java   
@Override
public void setShutdownStrategy(ShutdownStrategy shutdownStrategy) {
    context.setShutdownStrategy(shutdownStrategy);
}
项目:Camel    文件:CamelContext.java   
/**
 * Gets the current shutdown strategy
 *
 * @return the strategy
 */
ShutdownStrategy getShutdownStrategy();
项目:Camel    文件:CamelContext.java   
/**
 * Sets a custom shutdown strategy
 *
 * @param shutdownStrategy the custom strategy
 */
void setShutdownStrategy(ShutdownStrategy shutdownStrategy);