Java Code Examples for org.apache.camel.util.ServiceHelper#stopAndShutdownServices()

The following examples show how to use org.apache.camel.util.ServiceHelper#stopAndShutdownServices() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CamelStreamer.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Stops the streamer.
 *
 * @throws IgniteException In cases if failed to stop the streamer.
 */
public void stop() throws IgniteException {
    // If the Camel Context is stopping or stopped, reject this call to stop.
    if (camelCtx.getStatus() == ServiceStatus.Stopped || camelCtx.getStatus() == ServiceStatus.Stopping)
        throw new IgniteException("Failed to stop Camel streamer (CamelContext already stopped or stopping).");

    // Stop Camel services.
    try {
        ServiceHelper.stopAndShutdownServices(camelCtx, endpoint, consumer);
    }
    catch (Exception e) {
        throw new IgniteException("Failed to stop Camel streamer [errMsg=" + e.getMessage() + ']');
    }

    U.log(log, "Stopped Camel streamer, formerly consuming from endpoint URI: " + endpointUri);
}
 
Example 2
Source File: file_s.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
@Override
protected void doShutdown() throws Exception {
    ServiceHelper.stopAndShutdownServices(processors, errorHandlers, aggregationStrategy);
    // only clear error handlers when shutting down
    errorHandlers.clear();

    if (shutdownExecutorService && executorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
    }
    if (aggregateExecutorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(aggregateExecutorService);
    }
}
 
Example 3
Source File: file_t.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
@Override
protected void doShutdown() throws Exception {
    ServiceHelper.stopAndShutdownServices(processors, errorHandlers, aggregationStrategy);
    // only clear error handlers when shutting down
    errorHandlers.clear();

    if (shutdownExecutorService && executorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
    }
    if (aggregateExecutorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(aggregateExecutorService);
    }
}
 
Example 4
Source File: patched.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
@Override
protected void doShutdown() throws Exception {
    ServiceHelper.stopAndShutdownServices(processors, errorHandlers, aggregationStrategy);
    // only clear error handlers when shutting down
    errorHandlers.clear();

    if (shutdownExecutorService && executorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
    }
    if (aggregateExecutorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(aggregateExecutorService);
    }
}
 
Example 5
Source File: original.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
@Override
protected void doShutdown() throws Exception {
    ServiceHelper.stopAndShutdownServices(processors, errorHandlers, aggregationStrategy);
    // only clear error handlers when shutting down
    errorHandlers.clear();

    if (shutdownExecutorService && executorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
    }
    if (aggregateExecutorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(aggregateExecutorService);
    }
}
 
Example 6
Source File: file_s.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
@Override
protected void doShutdown() throws Exception {
    ServiceHelper.stopAndShutdownServices(processors, errorHandlers, aggregationStrategy);
    // only clear error handlers when shutting down
    errorHandlers.clear();

    if (shutdownExecutorService && executorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
    }
    if (aggregateExecutorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(aggregateExecutorService);
    }
}
 
Example 7
Source File: file_t.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
@Override
protected void doShutdown() throws Exception {
    ServiceHelper.stopAndShutdownServices(processors, errorHandlers, aggregationStrategy);
    // only clear error handlers when shutting down
    errorHandlers.clear();

    if (shutdownExecutorService && executorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
    }
    if (aggregateExecutorService != null) {
        getCamelContext().getExecutorServiceManager().shutdownNow(aggregateExecutorService);
    }
}