You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2018/10/03 15:05:11 UTC
[camel] 23/32: Simplify startService / stopService helpers
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit df9325134d69902456a20ab6e2fcc70d218fe36a
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Sep 28 12:01:48 2018 +0200
Simplify startService / stopService helpers
---
.../component/dataformat/DataFormatEndpoint.java | 4 +-
.../camel/component/direct/DirectComponent.java | 2 +-
.../camel/component/file/GenericFileEndpoint.java | 4 +-
.../apache/camel/component/rest/RestProducer.java | 4 +-
.../rest/RestProducerBindingProcessor.java | 4 +-
.../java/org/apache/camel/impl/ConsumerCache.java | 2 +-
.../org/apache/camel/impl/DefaultCamelContext.java | 4 +-
.../org/apache/camel/impl/DefaultConsumer.java | 4 +-
.../org/apache/camel/impl/DefaultDebugger.java | 2 +-
.../apache/camel/impl/DefaultEndpointRegistry.java | 4 +-
.../camel/impl/DefaultRuntimeEndpointRegistry.java | 4 +-
.../camel/impl/DefaultTransformerRegistry.java | 4 +-
.../camel/impl/DefaultValidatorRegistry.java | 4 +-
.../apache/camel/impl/InterceptSendToEndpoint.java | 4 +-
.../java/org/apache/camel/impl/ProducerCache.java | 2 +-
.../java/org/apache/camel/impl/RouteService.java | 2 +-
.../camel/impl/SubscribeMethodProcessor.java | 4 +-
.../management/DefaultManagementStrategy.java | 2 +-
.../apache/camel/processor/ChoiceProcessor.java | 4 +-
.../camel/processor/ClaimCheckProcessor.java | 4 +-
.../camel/processor/DelegateAsyncProcessor.java | 4 +-
.../apache/camel/processor/DelegateProcessor.java | 4 +-
.../camel/processor/DelegateSyncProcessor.java | 2 +-
.../java/org/apache/camel/processor/Enricher.java | 4 +-
.../InterceptorToAsyncProcessorBridge.java | 4 +-
.../apache/camel/processor/MulticastProcessor.java | 6 +-
.../org/apache/camel/processor/PollEnricher.java | 4 +-
.../org/apache/camel/processor/RecipientList.java | 4 +-
.../camel/processor/RedeliveryErrorHandler.java | 2 +-
.../org/apache/camel/processor/Resequencer.java | 4 +-
.../org/apache/camel/processor/RoutingSlip.java | 4 +-
.../camel/processor/SendDynamicProcessor.java | 4 +-
.../org/apache/camel/processor/SendProcessor.java | 2 +-
.../apache/camel/processor/StreamResequencer.java | 4 +-
.../org/apache/camel/processor/TryProcessor.java | 4 +-
.../processor/aggregate/AggregateProcessor.java | 4 +-
.../processor/idempotent/IdempotentConsumer.java | 4 +-
.../processor/interceptor/DefaultChannel.java | 4 +-
.../loadbalancer/LoadBalancerSupport.java | 4 +-
.../apache/camel/support/ChildServiceSupport.java | 4 +-
.../camel/util/AsyncProcessorConverterHelper.java | 4 +-
.../java/org/apache/camel/util/ServiceHelper.java | 80 +++++++---------------
.../directvm/AbstractDirectVmTestSupport.java | 4 +-
.../directvm/DirectVmConsumerExpressionTest.java | 8 +--
.../camel/component/vm/AbstractVmTestSupport.java | 4 +-
.../camel/processor/StreamResequencerTest.java | 2 +-
.../aggregator/AbstractDistributedTest.java | 2 +-
.../cdi/transaction/TransactionErrorHandler.java | 2 +-
.../org/apache/camel/component/jpa/JpaTest.java | 8 +--
.../jpa/JpaWithNamedQueryAndParametersTest.java | 4 +-
.../camel/component/jpa/JpaWithNamedQueryTest.java | 4 +-
.../processor/jpa/JpaProducerWithQueryTest.java | 4 +-
.../netty4/http/DefaultNettySharedHttpServer.java | 6 +-
.../component/netty4/http/NettyHttpComponent.java | 2 +-
.../camel/component/netty4/NettyConsumer.java | 2 +-
.../DualCamelContextEndpointOutsideTest.java | 2 +-
.../apache/camel/component/xmpp/XmppComponent.java | 2 +-
.../java/org/apache/camel/zipkin/ZipkinTracer.java | 2 +-
.../MasterEndpointFailoverTest.java | 14 ++--
.../zookeepermaster/MasterEndpointTest.java | 2 +-
.../zookeepermaster/MasterQuartz2EndpointTest.java | 2 +-
61 files changed, 134 insertions(+), 170 deletions(-)
diff --git a/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
index 9bc4cf9..e8e134c 100644
--- a/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
@@ -130,13 +130,13 @@ public class DataFormatEndpoint extends DefaultEndpoint {
processor = unmarshal;
}
- ServiceHelper.startServices(dataFormat, processor);
+ ServiceHelper.startService(dataFormat, processor);
super.doStart();
}
@Override
protected void doStop() throws Exception {
- ServiceHelper.stopServices(processor, dataFormat);
+ ServiceHelper.stopService(processor, dataFormat);
super.doStop();
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java b/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java
index 578dde4..b667f7b 100644
--- a/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java
@@ -53,7 +53,7 @@ public class DirectComponent extends DefaultComponent {
@Override
protected void doStop() throws Exception {
- ServiceHelper.stopServices(consumers);
+ ServiceHelper.stopService(consumers);
consumers.clear();
super.doStop();
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index fac9e7e..bf95c71 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -1516,13 +1516,13 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
if (idempotentRepository != null) {
getCamelContext().addService(idempotentRepository, true);
}
- ServiceHelper.startServices(inProgressRepository);
+ ServiceHelper.startService(inProgressRepository);
super.doStart();
}
@Override
protected void doStop() throws Exception {
super.doStop();
- ServiceHelper.stopServices(inProgressRepository);
+ ServiceHelper.stopService(inProgressRepository);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/rest/RestProducer.java b/camel-core/src/main/java/org/apache/camel/component/rest/RestProducer.java
index 83b36cc..7cbf42d 100644
--- a/camel-core/src/main/java/org/apache/camel/component/rest/RestProducer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/rest/RestProducer.java
@@ -231,13 +231,13 @@ public class RestProducer extends DefaultAsyncProducer {
// create binding processor (returns null if binding is not in use)
binding = createBindingProcessor();
- ServiceHelper.startServices(binding, producer);
+ ServiceHelper.startService(binding, producer);
}
@Override
protected void doStop() throws Exception {
super.doStop();
- ServiceHelper.stopServices(producer, binding);
+ ServiceHelper.stopService(producer, binding);
}
protected AsyncProcessor createBindingProcessor() throws Exception {
diff --git a/camel-core/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java b/camel-core/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java
index eeb2e83..fc6fbd7 100644
--- a/camel-core/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java
@@ -110,12 +110,12 @@ public class RestProducerBindingProcessor extends DelegateAsyncProcessor {
if (xmlUnmarshal instanceof CamelContextAware) {
((CamelContextAware) xmlUnmarshal).setCamelContext(camelContext);
}
- ServiceHelper.startServices(jsonMarshal, jsonUnmarshal, xmlMarshal, xmlUnmarshal);
+ ServiceHelper.startService(jsonMarshal, jsonUnmarshal, xmlMarshal, xmlUnmarshal);
}
@Override
protected void doStop() throws Exception {
- ServiceHelper.stopServices(jsonMarshal, jsonUnmarshal, xmlMarshal, xmlUnmarshal);
+ ServiceHelper.stopService(jsonMarshal, jsonUnmarshal, xmlMarshal, xmlUnmarshal);
}
@Override
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
index 2e07875..351d0d0 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
@@ -250,7 +250,7 @@ public class ConsumerCache extends ServiceSupport {
int max = maxCacheSize == 0 ? CamelContextHelper.getMaximumCachePoolSize(camelContext) : maxCacheSize;
statistics = new DefaultEndpointUtilizationStatistics(max);
}
- ServiceHelper.startServices(consumers);
+ ServiceHelper.startService(consumers);
}
protected void doStop() throws Exception {
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 2d04a78..4bfdb90 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -3071,7 +3071,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
log.info("Apache Camel {} (CamelContext: {}) is starting", getVersion(), getName());
// Start the route controller
- ServiceHelper.startServices(this.routeController);
+ ServiceHelper.startService(this.routeController);
doNotStartRoutesOnFirstStart = !firstStartDone && !isAutoStartup();
@@ -3266,7 +3266,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
ServiceHelper.startService(managementStrategy);
// start lifecycle strategies
- ServiceHelper.startServices(lifecycleStrategies);
+ ServiceHelper.startService(lifecycleStrategies);
Iterator<LifecycleStrategy> it = lifecycleStrategies.iterator();
while (it.hasNext()) {
LifecycleStrategy strategy = it.next();
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java
index 7066c35..c24701c 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java
@@ -137,12 +137,12 @@ public class DefaultConsumer extends ServiceSupport implements Consumer, RouteAw
protected void doStop() throws Exception {
log.debug("Stopping consumer: {}", this);
- ServiceHelper.stopServices(processor);
+ ServiceHelper.stopService(processor);
}
protected void doStart() throws Exception {
log.debug("Starting consumer: {}", this);
- ServiceHelper.startServices(processor);
+ ServiceHelper.startService(processor);
}
/**
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java
index 9d19fa1..dcd0a21 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java
@@ -353,7 +353,7 @@ public class DefaultDebugger implements Debugger, CamelContextAware {
public void stop() throws Exception {
breakpoints.clear();
singleSteps.clear();
- ServiceHelper.stopServices(debugEventNotifier);
+ ServiceHelper.stopService(debugEventNotifier);
}
@Override
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpointRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpointRegistry.java
index b9bc9a3..8ff1582 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpointRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpointRegistry.java
@@ -199,8 +199,8 @@ public class DefaultEndpointRegistry extends AbstractMap<EndpointKey, Endpoint>
@Override
public void stop() throws Exception {
- ServiceHelper.stopServices(staticMap.values());
- ServiceHelper.stopServices(values());
+ ServiceHelper.stopService(staticMap.values());
+ ServiceHelper.stopService(values());
purge();
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRuntimeEndpointRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRuntimeEndpointRegistry.java
index 17050a2..f799a79 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRuntimeEndpointRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultRuntimeEndpointRegistry.java
@@ -201,13 +201,13 @@ public class DefaultRuntimeEndpointRegistry extends EventNotifierSupport impleme
} else {
log.info("Runtime endpoint registry is in normal mode gathering information of all incoming and outgoing endpoints (cache limit: {})", limit);
}
- ServiceHelper.startServices(inputUtilization, outputUtilization);
+ ServiceHelper.startService(inputUtilization, outputUtilization);
}
@Override
protected void doStop() throws Exception {
clear();
- ServiceHelper.stopServices(inputUtilization, outputUtilization);
+ ServiceHelper.stopService(inputUtilization, outputUtilization);
}
@Override
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultTransformerRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultTransformerRegistry.java
index aeb54de..f24f643 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultTransformerRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultTransformerRegistry.java
@@ -261,8 +261,8 @@ public class DefaultTransformerRegistry extends AbstractMap<TransformerKey, Tran
@Override
public void stop() throws Exception {
- ServiceHelper.stopServices(staticMap.values());
- ServiceHelper.stopServices(dynamicMap.values());
+ ServiceHelper.stopService(staticMap.values());
+ ServiceHelper.stopService(dynamicMap.values());
purge();
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultValidatorRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultValidatorRegistry.java
index 06bc5bd..d937981 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultValidatorRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultValidatorRegistry.java
@@ -210,8 +210,8 @@ public class DefaultValidatorRegistry extends AbstractMap<ValidatorKey, Validato
@Override
public void stop() throws Exception {
- ServiceHelper.stopServices(staticMap.values());
- ServiceHelper.stopServices(dynamicMap.values());
+ ServiceHelper.stopService(staticMap.values());
+ ServiceHelper.stopService(dynamicMap.values());
purge();
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java
index ceeb7b3..3b8a0af 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java
@@ -123,11 +123,11 @@ public class InterceptSendToEndpoint implements Endpoint, ShutdownableService {
}
public void start() throws Exception {
- ServiceHelper.startServices(detour, delegate);
+ ServiceHelper.startService(detour, delegate);
}
public void stop() throws Exception {
- ServiceHelper.stopServices(delegate, detour);
+ ServiceHelper.stopService(delegate, detour);
}
@Override
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java b/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
index f3d8a5a..d6bdadb 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
@@ -373,7 +373,7 @@ public class ProducerCache extends ServiceSupport {
statistics = new DefaultEndpointUtilizationStatistics(max);
}
- ServiceHelper.startServices(producers, statistics);
+ ServiceHelper.startService(producers, statistics);
}
protected void doStop() throws Exception {
diff --git a/camel-core/src/main/java/org/apache/camel/impl/RouteService.java b/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
index 014554f..e224127 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
@@ -262,7 +262,7 @@ public class RouteService extends ChildServiceSupport {
if (isShutdownCamelContext) {
ServiceHelper.stopAndShutdownServices(route);
} else {
- ServiceHelper.stopServices(route);
+ ServiceHelper.stopService(route);
}
// invoke callbacks on route policy
diff --git a/camel-core/src/main/java/org/apache/camel/impl/SubscribeMethodProcessor.java b/camel-core/src/main/java/org/apache/camel/impl/SubscribeMethodProcessor.java
index bf39a7e..9ce1eaa 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/SubscribeMethodProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/SubscribeMethodProcessor.java
@@ -96,12 +96,12 @@ public final class SubscribeMethodProcessor extends ServiceSupport implements As
@Override
protected void doStart() throws Exception {
- ServiceHelper.startServices(methods.keySet());
+ ServiceHelper.startService(methods.keySet());
}
@Override
protected void doStop() throws Exception {
- ServiceHelper.stopServices(methods.keySet());
+ ServiceHelper.stopService(methods.keySet());
}
@Override
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementStrategy.java b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementStrategy.java
index e92703f..8d00550 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementStrategy.java
@@ -203,7 +203,7 @@ public class DefaultManagementStrategy extends ServiceSupport implements Managem
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(managementAgent, eventNotifiers);
+ ServiceHelper.stopService(managementAgent, eventNotifiers);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java
index 1d3d6e0..5c1c54f 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java
@@ -199,11 +199,11 @@ public class ChoiceProcessor extends ServiceSupport implements AsyncProcessor, N
}
protected void doStart() throws Exception {
- ServiceHelper.startServices(filters, otherwise);
+ ServiceHelper.startService(filters, otherwise);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(otherwise, filters);
+ ServiceHelper.stopService(otherwise, filters);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
index cedf95f..19743f5 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ClaimCheckProcessor.java
@@ -182,12 +182,12 @@ public class ClaimCheckProcessor extends ServiceSupport implements AsyncProcesso
((CamelContextAware) aggregationStrategy).setCamelContext(camelContext);
}
- ServiceHelper.startServices(aggregationStrategy);
+ ServiceHelper.startService(aggregationStrategy);
}
@Override
protected void doStop() throws Exception {
- ServiceHelper.stopServices(aggregationStrategy);
+ ServiceHelper.stopService(aggregationStrategy);
}
@Override
diff --git a/camel-core/src/main/java/org/apache/camel/processor/DelegateAsyncProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/DelegateAsyncProcessor.java
index daf7178..d8e0919 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/DelegateAsyncProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/DelegateAsyncProcessor.java
@@ -77,11 +77,11 @@ public class DelegateAsyncProcessor extends ServiceSupport implements DelegatePr
}
protected void doStart() throws Exception {
- ServiceHelper.startServices(processor);
+ ServiceHelper.startService(processor);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(processor);
+ ServiceHelper.stopService(processor);
}
protected void doShutdown() throws Exception {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java
index 4c2d79c..afbb108 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java
@@ -73,11 +73,11 @@ public class DelegateProcessor extends ServiceSupport implements org.apache.came
}
protected void doStart() throws Exception {
- ServiceHelper.startServices(processor);
+ ServiceHelper.startService(processor);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(processor);
+ ServiceHelper.stopService(processor);
}
public boolean hasNext() {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/DelegateSyncProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/DelegateSyncProcessor.java
index 8b5906e..10879e5 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/DelegateSyncProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/DelegateSyncProcessor.java
@@ -98,6 +98,6 @@ public class DelegateSyncProcessor extends ServiceSupport implements org.apache.
@Override
protected void doStop() throws Exception {
- ServiceHelper.stopServices(processor);
+ ServiceHelper.stopService(processor);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/Enricher.java b/camel-core/src/main/java/org/apache/camel/processor/Enricher.java
index a8e1e43..2f488b3 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/Enricher.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/Enricher.java
@@ -349,11 +349,11 @@ public class Enricher extends ServiceSupport implements AsyncProcessor, IdAware,
LOG.debug("Enricher {} using ProducerCache with cacheSize={}", this, producerCache.getCapacity());
}
- ServiceHelper.startServices(producerCache, aggregationStrategy);
+ ServiceHelper.startService(producerCache, aggregationStrategy);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(aggregationStrategy, producerCache);
+ ServiceHelper.stopService(aggregationStrategy, producerCache);
}
private static class CopyAggregationStrategy implements AggregationStrategy {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/InterceptorToAsyncProcessorBridge.java b/camel-core/src/main/java/org/apache/camel/processor/InterceptorToAsyncProcessorBridge.java
index 7541c5f..70dde17 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/InterceptorToAsyncProcessorBridge.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/InterceptorToAsyncProcessorBridge.java
@@ -99,13 +99,13 @@ public class InterceptorToAsyncProcessorBridge extends ServiceSupport implements
@Override
protected void doStart() throws Exception {
- ServiceHelper.startServices(target, interceptor);
+ ServiceHelper.startService(target, interceptor);
}
@Override
protected void doStop() throws Exception {
callback.remove();
interceptorDone.remove();
- ServiceHelper.stopServices(interceptor, target);
+ ServiceHelper.stopService(interceptor, target);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
index c3f5dd0..44ab3cb 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
@@ -1082,7 +1082,7 @@ public class MulticastProcessor extends ServiceSupport implements AsyncProcessor
boolean child = exchange.getProperty(Exchange.PARENT_UNIT_OF_WORK, UnitOfWork.class) != null;
// must start the error handler
- ServiceHelper.startServices(answer);
+ ServiceHelper.startService(answer);
// here we don't cache the child unit of work
if (!child) {
@@ -1154,7 +1154,7 @@ public class MulticastProcessor extends ServiceSupport implements AsyncProcessor
((CamelContextAware) aggregationStrategy).setCamelContext(camelContext);
}
- ServiceHelper.startServices(aggregationStrategy, processors);
+ ServiceHelper.startService(aggregationStrategy, processors);
}
/**
@@ -1171,7 +1171,7 @@ public class MulticastProcessor extends ServiceSupport implements AsyncProcessor
@Override
protected void doStop() throws Exception {
- ServiceHelper.stopServices(processors, errorHandlers, aggregationStrategy);
+ ServiceHelper.stopService(processors, errorHandlers, aggregationStrategy);
}
@Override
diff --git a/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java b/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
index ebb3c76..06408fc 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
@@ -378,11 +378,11 @@ public class PollEnricher extends ServiceSupport implements AsyncProcessor, IdAw
if (aggregationStrategy instanceof CamelContextAware) {
((CamelContextAware) aggregationStrategy).setCamelContext(camelContext);
}
- ServiceHelper.startServices(consumerCache, aggregationStrategy);
+ ServiceHelper.startService(consumerCache, aggregationStrategy);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(aggregationStrategy, consumerCache);
+ ServiceHelper.stopService(aggregationStrategy, consumerCache);
}
protected void doShutdown() throws Exception {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java b/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
index 2d92c75..108b1dd 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
@@ -189,11 +189,11 @@ public class RecipientList extends ServiceSupport implements AsyncProcessor, IdA
producerCache = new ProducerCache(this, camelContext, cacheSize);
LOG.debug("RecipientList {} using ProducerCache with cacheSize={}", this, producerCache.getCapacity());
}
- ServiceHelper.startServices(aggregationStrategy, producerCache);
+ ServiceHelper.startService(aggregationStrategy, producerCache);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(producerCache, aggregationStrategy);
+ ServiceHelper.stopService(producerCache, aggregationStrategy);
}
protected void doShutdown() throws Exception {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
index 96dcf6e..c0d8610 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
@@ -1481,7 +1481,7 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport impleme
@Override
protected void doStart() throws Exception {
- ServiceHelper.startServices(output, outputAsync, deadLetter);
+ ServiceHelper.startService(output, outputAsync, deadLetter);
// determine if redeliver is enabled or not
redeliveryEnabled = determineIfRedeliveryIsEnabled();
diff --git a/camel-core/src/main/java/org/apache/camel/processor/Resequencer.java b/camel-core/src/main/java/org/apache/camel/processor/Resequencer.java
index 8edd542..c064b15 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/Resequencer.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/Resequencer.java
@@ -307,13 +307,13 @@ public class Resequencer extends ServiceSupport implements AsyncProcessor, Navig
}
protected void doStart() throws Exception {
- ServiceHelper.startServices(processor);
+ ServiceHelper.startService(processor);
sender.start();
}
protected void doStop() throws Exception {
sender.cancel();
- ServiceHelper.stopServices(processor);
+ ServiceHelper.stopService(processor);
collection.clear();
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
index c2aeefa..915b09b 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
@@ -442,11 +442,11 @@ public class RoutingSlip extends ServiceSupport implements AsyncProcessor, Trace
log.debug("RoutingSlip {} using ProducerCache with cacheSize={}", this, producerCache.getCapacity());
}
- ServiceHelper.startServices(producerCache, errorHandler);
+ ServiceHelper.startService(producerCache, errorHandler);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(producerCache, errorHandler);
+ ServiceHelper.stopService(producerCache, errorHandler);
}
protected void doShutdown() throws Exception {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
index 2f52a94..21d3d87 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
@@ -279,11 +279,11 @@ public class SendDynamicProcessor extends ServiceSupport implements AsyncProcess
}
}
- ServiceHelper.startServices(producerCache);
+ ServiceHelper.startService(producerCache);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(producerCache);
+ ServiceHelper.stopService(producerCache);
}
public EndpointUtilizationStatistics getEndpointUtilizationStatistics() {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
index f57c309..0548bf7 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
@@ -245,7 +245,7 @@ public class SendProcessor extends ServiceSupport implements AsyncProcessor, Tra
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(producerCache, producer);
+ ServiceHelper.stopService(producerCache, producer);
}
protected void doShutdown() throws Exception {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/StreamResequencer.java b/camel-core/src/main/java/org/apache/camel/processor/StreamResequencer.java
index 3fac08a..6b1df38 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/StreamResequencer.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/StreamResequencer.java
@@ -194,7 +194,7 @@ public class StreamResequencer extends ServiceSupport implements SequenceSender<
@Override
protected void doStart() throws Exception {
- ServiceHelper.startServices(processor);
+ ServiceHelper.startService(processor);
delivery = new Delivery();
engine.start();
delivery.start();
@@ -205,7 +205,7 @@ public class StreamResequencer extends ServiceSupport implements SequenceSender<
// let's stop everything in the reverse order
// no need to stop the worker thread -- it will stop automatically when this service is stopped
engine.stop();
- ServiceHelper.stopServices(processor);
+ ServiceHelper.stopService(processor);
}
/**
diff --git a/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
index 71d2538..2573fe1 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
@@ -160,11 +160,11 @@ public class TryProcessor extends ServiceSupport implements AsyncProcessor, Navi
}
protected void doStart() throws Exception {
- ServiceHelper.startServices(tryProcessor, catchClauses, finallyProcessor);
+ ServiceHelper.startService(tryProcessor, catchClauses, finallyProcessor);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(tryProcessor, catchClauses, finallyProcessor);
+ ServiceHelper.stopService(tryProcessor, catchClauses, finallyProcessor);
}
public List<Processor> next() {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
index c32d34a..d9078d7 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
@@ -1381,7 +1381,7 @@ public class AggregateProcessor extends ServiceSupport implements AsyncProcessor
LOG.info("Optimistic locking is enabled");
}
- ServiceHelper.startServices(aggregationStrategy, processor, aggregationRepository);
+ ServiceHelper.startService(aggregationStrategy, processor, aggregationRepository);
// should we use recover checker
if (aggregationRepository instanceof RecoverableAggregationRepository) {
@@ -1470,7 +1470,7 @@ public class AggregateProcessor extends ServiceSupport implements AsyncProcessor
shutdownTimeoutCheckerExecutorService = false;
}
- ServiceHelper.stopServices(timeoutMap, processor, deadLetterProducerTemplate);
+ ServiceHelper.stopService(timeoutMap, processor, deadLetterProducerTemplate);
if (closedCorrelationKeys != null) {
// it may be a service so stop it as well
diff --git a/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java b/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
index bfc960e..9ce5d85 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
@@ -208,11 +208,11 @@ public class IdempotentConsumer extends ServiceSupport implements CamelContextAw
if (!camelContext.hasService(idempotentRepository)) {
camelContext.addService(idempotentRepository);
}
- ServiceHelper.startServices(processor, idempotentRepository);
+ ServiceHelper.startService(processor, idempotentRepository);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(processor, idempotentRepository);
+ ServiceHelper.stopService(processor, idempotentRepository);
}
@Override
diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
index 32b74bb..96aa6d6 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
@@ -157,14 +157,14 @@ public class DefaultChannel extends CamelInternalProcessor implements ModelChann
protected void doStart() throws Exception {
// the output has now been created, so assign the output as the processor
setProcessor(getOutput());
- ServiceHelper.startServices(errorHandler, output);
+ ServiceHelper.startService(errorHandler, output);
}
@Override
protected void doStop() throws Exception {
if (!isContextScoped()) {
// only stop services if not context scoped (as context scoped is reused by others)
- ServiceHelper.stopServices(output, errorHandler);
+ ServiceHelper.stopService(output, errorHandler);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerSupport.java b/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerSupport.java
index fe22f0b..ca8dfef 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerSupport.java
@@ -78,11 +78,11 @@ public abstract class LoadBalancerSupport extends ServiceSupport implements Load
}
protected void doStart() throws Exception {
- ServiceHelper.startServices(processors);
+ ServiceHelper.startService(processors);
}
protected void doStop() throws Exception {
- ServiceHelper.stopServices(processors);
+ ServiceHelper.stopService(processors);
}
@Override
diff --git a/camel-core/src/main/java/org/apache/camel/support/ChildServiceSupport.java b/camel-core/src/main/java/org/apache/camel/support/ChildServiceSupport.java
index e51fafa..42cdbea 100644
--- a/camel-core/src/main/java/org/apache/camel/support/ChildServiceSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/support/ChildServiceSupport.java
@@ -38,7 +38,7 @@ public abstract class ChildServiceSupport extends ServiceSupport {
Exception ex = null;
try {
if (childServices != null && startChildren) {
- ServiceHelper.startServices(childServices);
+ ServiceHelper.startService(childServices);
}
childrenStarted = true;
doStart();
@@ -80,7 +80,7 @@ public abstract class ChildServiceSupport extends ServiceSupport {
started.set(false);
suspended.set(false);
if (childServices != null) {
- ServiceHelper.stopServices(childServices);
+ ServiceHelper.stopService(childServices);
}
}
} finally {
diff --git a/camel-core/src/main/java/org/apache/camel/util/AsyncProcessorConverterHelper.java b/camel-core/src/main/java/org/apache/camel/util/AsyncProcessorConverterHelper.java
index 2162c05..c0f1b20 100644
--- a/camel-core/src/main/java/org/apache/camel/util/AsyncProcessorConverterHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/AsyncProcessorConverterHelper.java
@@ -92,11 +92,11 @@ public final class AsyncProcessorConverterHelper {
}
public void start() throws Exception {
- ServiceHelper.startServices(processor);
+ ServiceHelper.startService(processor);
}
public void stop() throws Exception {
- ServiceHelper.stopServices(processor);
+ ServiceHelper.stopService(processor);
}
public boolean hasNext() {
diff --git a/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java b/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
index 730d53f..3346765 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
@@ -51,57 +51,28 @@ public final class ServiceHelper {
* Starts the given {@code value} if it's a {@link Service} or a collection of it.
* <p/>
* Calling this method has no effect if {@code value} is {@code null}.
- *
- * @see #startService(Service)
- * @see #startServices(Collection)
*/
public static void startService(Object value) throws Exception {
if (value instanceof Service) {
- startService((Service)value);
- } else if (value instanceof Collection) {
- startServices((Collection<?>)value);
+ ((Service) value).start();
+ } else if (value instanceof Iterable) {
+ for (Object o : (Iterable) value) {
+ startService(o);
+ }
}
}
/**
- * Starts the given {@code service}.
- * <p/>
- * Calling this method has no effect if {@code service} is {@code null}.
- *
- * @see Service#start()
- */
- public static void startService(Service service) throws Exception {
- if (service != null) {
- service.start();
- }
- }
-
- /**
- * Starts each element of the given {@code services} if {@code services} itself is
- * not {@code null}, otherwise this method would return immediately.
- *
- * @see #startServices(Collection)
- */
- public static void startServices(Object... services) throws Exception {
- if (services == null) {
- return;
- }
- List<Object> list = Arrays.asList(services);
- startServices(list);
- }
-
- /**
* Starts each element of the given {@code services} if {@code services} itself is
* not {@code null}, otherwise this method would return immediately.
*
* @see #startService(Object)
*/
- public static void startServices(Collection<?> services) throws Exception {
- if (services == null) {
- return;
- }
- for (Object value : services) {
- startService(value);
+ public static void startService(Object... services) throws Exception {
+ if (services != null) {
+ for (Object o : services) {
+ startService(o);
+ }
}
}
@@ -112,14 +83,14 @@ public final class ServiceHelper {
* If there's any exception being thrown while stopping the elements one after the
* other this method would rethrow the <b>first</b> such exception being thrown.
*
- * @see #stopServices(Collection)
+ * @see #stopService(Collection)
*/
- public static void stopServices(Object... services) throws Exception {
- if (services == null) {
- return;
+ public static void stopService(Object... services) throws Exception {
+ if (services != null) {
+ for (Object o : services) {
+ stopService(o);
+ }
}
- List<Object> list = Arrays.asList(services);
- stopServices(list);
}
/**
@@ -128,20 +99,15 @@ public final class ServiceHelper {
* Calling this method has no effect if {@code value} is {@code null}.
*
* @see Service#stop()
- * @see #stopServices(Collection)
+ * @see #stopService(Collection)
*/
public static void stopService(Object value) throws Exception {
- if (isStopped(value)) {
- // only stop service if not already stopped
- LOG.trace("Service already stopped: {}", value);
- return;
- }
if (value instanceof Service) {
- Service service = (Service)value;
- LOG.trace("Stopping service {}", value);
- service.stop();
- } else if (value instanceof Collection) {
- stopServices((Collection<?>)value);
+ ((Service) value).stop();
+ } else if (value instanceof Iterable) {
+ for (Object o : (Iterable) value) {
+ stopService(o);
+ }
}
}
@@ -154,7 +120,7 @@ public final class ServiceHelper {
*
* @see #stopService(Object)
*/
- public static void stopServices(Collection<?> services) throws Exception {
+ public static void stopService(Collection<?> services) throws Exception {
if (services == null) {
return;
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/directvm/AbstractDirectVmTestSupport.java b/camel-core/src/test/java/org/apache/camel/component/directvm/AbstractDirectVmTestSupport.java
index c62237f..45773d3 100644
--- a/camel-core/src/test/java/org/apache/camel/component/directvm/AbstractDirectVmTestSupport.java
+++ b/camel-core/src/test/java/org/apache/camel/component/directvm/AbstractDirectVmTestSupport.java
@@ -42,7 +42,7 @@ public abstract class AbstractDirectVmTestSupport extends ContextTestSupport {
context2 = new DefaultCamelContext();
template2 = context2.createProducerTemplate();
- ServiceHelper.startServices(template2, context2);
+ ServiceHelper.startService(template2, context2);
// add routes after CamelContext has been started
RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
@@ -58,7 +58,7 @@ public abstract class AbstractDirectVmTestSupport extends ContextTestSupport {
@Override
@After
public void tearDown() throws Exception {
- ServiceHelper.stopServices(context2, template2);
+ ServiceHelper.stopService(context2, template2);
super.tearDown();
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmConsumerExpressionTest.java b/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmConsumerExpressionTest.java
index 9305388..7f444ba 100644
--- a/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmConsumerExpressionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmConsumerExpressionTest.java
@@ -44,9 +44,9 @@ public class DirectVmConsumerExpressionTest extends ContextTestSupport {
context3 = new DefaultCamelContext();
context4 = new DefaultCamelContext();
- ServiceHelper.startServices(context2);
- ServiceHelper.startServices(context3);
- ServiceHelper.startServices(context4);
+ ServiceHelper.startService(context2);
+ ServiceHelper.startService(context3);
+ ServiceHelper.startService(context4);
// add routes after CamelContext has been started
RouteBuilder routeBuilder = createRouteBuilderCamelContext2();
@@ -68,7 +68,7 @@ public class DirectVmConsumerExpressionTest extends ContextTestSupport {
@Override
@After
public void tearDown() throws Exception {
- ServiceHelper.stopServices(context2, context3, context4);
+ ServiceHelper.stopService(context2, context3, context4);
super.tearDown();
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/vm/AbstractVmTestSupport.java b/camel-core/src/test/java/org/apache/camel/component/vm/AbstractVmTestSupport.java
index d9ec953..a205c5b 100644
--- a/camel-core/src/test/java/org/apache/camel/component/vm/AbstractVmTestSupport.java
+++ b/camel-core/src/test/java/org/apache/camel/component/vm/AbstractVmTestSupport.java
@@ -40,7 +40,7 @@ public abstract class AbstractVmTestSupport extends ContextTestSupport {
context2 = new DefaultCamelContext();
template2 = context2.createProducerTemplate();
- ServiceHelper.startServices(template2, context2);
+ ServiceHelper.startService(template2, context2);
// add routes after CamelContext has been started
RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
@@ -52,7 +52,7 @@ public abstract class AbstractVmTestSupport extends ContextTestSupport {
@Override
@After
public void tearDown() throws Exception {
- ServiceHelper.stopServices(context2, template2);
+ ServiceHelper.stopService(context2, template2);
VmComponent.ENDPOINTS.clear();
VmComponent.QUEUES.clear();
super.tearDown();
diff --git a/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java b/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
index 4f4dd0c..faad47c 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
@@ -79,7 +79,7 @@ public class StreamResequencerTest extends ContextTestSupport {
assertMockEndpointsSatisfied();
- ServiceHelper.stopServices(producerTemplate, producerTemplate2);
+ ServiceHelper.stopService(producerTemplate, producerTemplate2);
}
@Override
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AbstractDistributedTest.java b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AbstractDistributedTest.java
index 4bae1f5..13fcf2b 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AbstractDistributedTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AbstractDistributedTest.java
@@ -43,7 +43,7 @@ public abstract class AbstractDistributedTest extends ContextTestSupport {
context2 = new DefaultCamelContext();
context2.setUseMDCLogging(true);
template2 = context2.createProducerTemplate();
- ServiceHelper.startServices(template2, context2);
+ ServiceHelper.startService(template2, context2);
// add routes after CamelContext has been started
context2.adapt(ModelCamelContext.class).addRoutes(createRouteBuilder2());
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionErrorHandler.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionErrorHandler.java
index 57245b5..ae391ca 100644
--- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionErrorHandler.java
+++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionErrorHandler.java
@@ -327,7 +327,7 @@ public class TransactionErrorHandler extends ErrorHandlerSupport
@Override
protected void doStart() throws Exception {
- ServiceHelper.startServices(output);
+ ServiceHelper.startService(output);
preparingShutdown = false;
}
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
index e4bc79b..d13537c 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaTest.java
@@ -30,6 +30,7 @@ import org.apache.camel.Processor;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.examples.SendEmail;
import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.util.ServiceHelper;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -40,9 +41,6 @@ import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
-import static org.apache.camel.util.ServiceHelper.startServices;
-import static org.apache.camel.util.ServiceHelper.stopServices;
-
/**
* @version
*/
@@ -110,7 +108,7 @@ public class JpaTest extends Assert {
@Before
public void setUp() throws Exception {
template = camelContext.createProducerTemplate();
- startServices(template, camelContext);
+ ServiceHelper.startService(template, camelContext);
Endpoint value = camelContext.getEndpoint(getEndpointUri());
assertNotNull("Could not find endpoint!", value);
@@ -127,6 +125,6 @@ public class JpaTest extends Assert {
@After
public void tearDown() throws Exception {
- stopServices(consumer, template, camelContext);
+ ServiceHelper.stopService(consumer, template, camelContext);
}
}
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryAndParametersTest.java b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryAndParametersTest.java
index 507efa7..4058126 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryAndParametersTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryAndParametersTest.java
@@ -130,7 +130,7 @@ public class JpaWithNamedQueryAndParametersTest extends Assert {
camelContext.setRegistry(registry);
template = camelContext.createProducerTemplate();
- ServiceHelper.startServices(template, camelContext);
+ ServiceHelper.startService(template, camelContext);
Endpoint value = camelContext.getEndpoint(getEndpointUri());
assertNotNull("Could not find endpoint!", value);
@@ -147,6 +147,6 @@ public class JpaWithNamedQueryAndParametersTest extends Assert {
@After
public void tearDown() throws Exception {
- ServiceHelper.stopServices(consumer, template, camelContext);
+ ServiceHelper.stopService(consumer, template, camelContext);
}
}
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
index 0e66265..b81456e 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java
@@ -164,7 +164,7 @@ public class JpaWithNamedQueryTest extends Assert {
@Before
public void setUp() throws Exception {
template = camelContext.createProducerTemplate();
- ServiceHelper.startServices(template, camelContext);
+ ServiceHelper.startService(template, camelContext);
Endpoint value = camelContext.getEndpoint(getEndpointUri());
assertNotNull("Could not find endpoint!", value);
@@ -181,6 +181,6 @@ public class JpaWithNamedQueryTest extends Assert {
@After
public void tearDown() throws Exception {
- ServiceHelper.stopServices(consumer, template, camelContext);
+ ServiceHelper.stopService(consumer, template, camelContext);
}
}
diff --git a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaProducerWithQueryTest.java b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaProducerWithQueryTest.java
index 880703e..f00f593 100644
--- a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaProducerWithQueryTest.java
+++ b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaProducerWithQueryTest.java
@@ -152,11 +152,11 @@ public class JpaProducerWithQueryTest extends Assert {
});
template = camelContext.createProducerTemplate();
- ServiceHelper.startServices(template, camelContext);
+ ServiceHelper.startService(template, camelContext);
}
@After
public void tearDown() throws Exception {
- ServiceHelper.stopServices(template, camelContext);
+ ServiceHelper.stopService(template, camelContext);
}
}
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettySharedHttpServer.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettySharedHttpServer.java
index 7b122f6..275b78d 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettySharedHttpServer.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettySharedHttpServer.java
@@ -124,17 +124,17 @@ public class DefaultNettySharedHttpServer extends ServiceSupport implements Nett
bootstrapFactory = new HttpServerBootstrapFactory(channelFactory, false);
bootstrapFactory.init(tf, configuration, pipelineFactory);
- ServiceHelper.startServices(channelFactory);
+ ServiceHelper.startService(channelFactory);
if (startServer) {
LOG.info("Starting NettySharedHttpServer on {}:{}", configuration.getHost(), configuration.getPort());
- ServiceHelper.startServices(bootstrapFactory);
+ ServiceHelper.startService(bootstrapFactory);
}
}
@Override
protected void doStop() throws Exception {
LOG.info("Stopping NettySharedHttpServer on {}:{}", configuration.getHost(), configuration.getPort());
- ServiceHelper.stopServices(bootstrapFactory, channelFactory);
+ ServiceHelper.stopService(bootstrapFactory, channelFactory);
}
}
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java
index a1ba68e..c465a4f 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java
@@ -489,7 +489,7 @@ public class NettyHttpComponent extends NettyComponent implements HeaderFilterSt
protected void doStop() throws Exception {
super.doStop();
- ServiceHelper.stopServices(bootstrapFactories.values());
+ ServiceHelper.stopService(bootstrapFactories.values());
bootstrapFactories.clear();
ServiceHelper.stopService(multiplexChannelHandlers.values());
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConsumer.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConsumer.java
index 8c185a0..705bc5f 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConsumer.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConsumer.java
@@ -70,7 +70,7 @@ public class NettyConsumer extends DefaultConsumer {
nettyServerBootstrapFactory.init(context, configuration, pipelineFactory);
}
- ServiceHelper.startServices(nettyServerBootstrapFactory);
+ ServiceHelper.startService(nettyServerBootstrapFactory);
LOG.info("Netty consumer bound to: {}", configuration.getAddress());
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/DualCamelContextEndpointOutsideTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/config/DualCamelContextEndpointOutsideTest.java
index 121358d..7bae6f3 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/DualCamelContextEndpointOutsideTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/DualCamelContextEndpointOutsideTest.java
@@ -55,7 +55,7 @@ public class DualCamelContextEndpointOutsideTest extends SpringTestSupport {
producer2.sendBody("direct:start2", "Hello B");
// make sure we properly stop the services we created
- ServiceHelper.stopServices(producer1, producer2);
+ ServiceHelper.stopService(producer1, producer2);
mockA.assertIsSatisfied();
mockB.assertIsSatisfied();
diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppComponent.java b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppComponent.java
index e301b60..03c7b1f 100644
--- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppComponent.java
+++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppComponent.java
@@ -90,7 +90,7 @@ public class XmppComponent extends DefaultComponent {
@Override
protected void doStop() throws Exception {
- ServiceHelper.stopServices(endpointCache.values());
+ ServiceHelper.stopService(endpointCache.values());
endpointCache.clear();
super.doStop();
diff --git a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java
index abad90e..1c95673 100644
--- a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java
+++ b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java
@@ -412,7 +412,7 @@ public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory,
createTracingForService(pattern, serviceName);
}
- ServiceHelper.startServices(spanReporter, eventNotifier);
+ ServiceHelper.startService(spanReporter, eventNotifier);
}
@Override
diff --git a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointFailoverTest.java b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointFailoverTest.java
index 887bef1..bc5f0cb 100644
--- a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointFailoverTest.java
+++ b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointFailoverTest.java
@@ -89,17 +89,17 @@ public class MasterEndpointFailoverTest {
}
});
// Need to start at less one consumerContext to enable the vm queue for producerContext
- ServiceHelper.startServices(consumerContext1);
- ServiceHelper.startServices(producerContext);
+ ServiceHelper.startService(consumerContext1);
+ ServiceHelper.startService(producerContext);
result1Endpoint = consumerContext1.getEndpoint("mock:result1", MockEndpoint.class);
result2Endpoint = consumerContext2.getEndpoint("mock:result2", MockEndpoint.class);
}
@After
public void afterRun() throws Exception {
- ServiceHelper.stopServices(consumerContext1);
- ServiceHelper.stopServices(consumerContext2);
- ServiceHelper.stopServices(producerContext);
+ ServiceHelper.stopService(consumerContext1);
+ ServiceHelper.stopService(consumerContext2);
+ ServiceHelper.stopService(producerContext);
zkClientBean.destroy();
serverFactoryBean.destroy();
}
@@ -108,11 +108,11 @@ public class MasterEndpointFailoverTest {
public void testEndpoint() throws Exception {
System.out.println("Starting consumerContext1");
- ServiceHelper.startServices(consumerContext1);
+ ServiceHelper.startService(consumerContext1);
assertMessageReceived(result1Endpoint, result2Endpoint);
System.out.println("Starting consumerContext2");
- ServiceHelper.startServices(consumerContext2);
+ ServiceHelper.startService(consumerContext2);
assertMessageReceivedLoop(result1Endpoint, result2Endpoint, 3);
System.out.println("Stopping consumerContext1");
diff --git a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointTest.java b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointTest.java
index b1d88e5..3df5eae 100644
--- a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointTest.java
+++ b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointTest.java
@@ -71,7 +71,7 @@ public class MasterEndpointTest extends AbstractJUnit4SpringContextTests {
public void afterRun() throws Exception {
lastServerBean = zkServerBean;
lastClientBean = zkClientBean;
- ServiceHelper.stopServices(camelContext);
+ ServiceHelper.stopService(camelContext);
}
@AfterClass
diff --git a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterQuartz2EndpointTest.java b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterQuartz2EndpointTest.java
index f4c77a8..95c0a31 100644
--- a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterQuartz2EndpointTest.java
+++ b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterQuartz2EndpointTest.java
@@ -58,7 +58,7 @@ public class MasterQuartz2EndpointTest extends AbstractJUnit4SpringContextTests
public void afterRun() throws Exception {
lastServerBean = zkServerBean;
lastClientBean = zkClientBean;
- ServiceHelper.stopServices(camelContext);
+ ServiceHelper.stopService(camelContext);
}
@AfterClass