This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f29c681eb9dda7c6beaf934fd040c9381a36aeaf
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Jan 23 11:56:26 2021 +0100

    CAMEL-15844: Add javadoc about init/start logic not in constructors.
---
 .../src/main/java/org/apache/camel/Consumer.java         |  6 +++++-
 .../src/main/java/org/apache/camel/Endpoint.java         | 16 +++++++++++++++-
 .../src/main/java/org/apache/camel/PollingConsumer.java  |  4 ++++
 .../src/main/java/org/apache/camel/Producer.java         |  6 +++++-
 4 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/Consumer.java 
b/core/camel-api/src/main/java/org/apache/camel/Consumer.java
index 3d08aca..bd368e3e 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Consumer.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Consumer.java
@@ -17,7 +17,11 @@
 package org.apache.camel;
 
 /**
- * A consumer of message exchanges from an {@link Endpoint}
+ * A consumer of message exchanges from an {@link Endpoint}.
+ * <p/>
+ * Important: Do not do any initialization in the constructor.
+ * Instead use {@link 
org.apache.camel.support.service.ServiceSupport#doInit()} or
+ * {@link org.apache.camel.support.service.ServiceSupport#doStart()}.
  */
 public interface Consumer extends Service, EndpointAware {
 
diff --git a/core/camel-api/src/main/java/org/apache/camel/Endpoint.java 
b/core/camel-api/src/main/java/org/apache/camel/Endpoint.java
index 1ffc371..39be552 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Endpoint.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Endpoint.java
@@ -18,6 +18,8 @@ package org.apache.camel;
 
 import java.util.Map;
 
+import org.apache.camel.support.service.ServiceSupport;
+
 /**
  * An <a href="http://camel.apache.org/endpoint.html";>endpoint</a> implements 
the
  * <a href="http://camel.apache.org/message-endpoint.html";>Message 
Endpoint</a> pattern and represents an endpoint that
@@ -84,7 +86,10 @@ public interface Endpoint extends IsSingleton, Service {
     CamelContext getCamelContext();
 
     /**
-     * Creates a new producer which is used send messages into the endpoint
+     * Creates a new producer which is used send messages into the endpoint.
+     *
+     * Important: Do not do any initialization in the constructor of the 
{@link Producer}.
+     * Instead use {@link ServiceSupport#doInit()} or {@link 
ServiceSupport#doStart()}.
      *
      * @return           a newly created producer
      * @throws Exception can be thrown
@@ -101,6 +106,9 @@ public interface Endpoint extends IsSingleton, Service {
     /**
      * Creates a new producer which is used send messages into the endpoint
      *
+     * Important: Do not do any initialization in the constructor of the 
{@link Producer}.
+     * Instead use {@link ServiceSupport#doInit()} or {@link 
ServiceSupport#doStart()}.
+     *
      * @return           a newly created producer
      * @throws Exception can be thrown
      */
@@ -110,6 +118,9 @@ public interface Endpoint extends IsSingleton, Service {
      * Creates a new <a 
href="http://camel.apache.org/event-driven-consumer.html";>Event Driven 
Consumer</a> which
      * consumes messages from the endpoint using the given processor
      *
+     * Important: Do not do any initialization in the constructor of the 
{@link Consumer}.
+     * Instead use {@link ServiceSupport#doInit()} or {@link 
ServiceSupport#doStart()}.
+     *
      * @param  processor the given processor
      * @return           a newly created consumer
      * @throws Exception can be thrown
@@ -123,6 +134,9 @@ public interface Endpoint extends IsSingleton, Service {
      * rather than using the <a 
href="http://camel.apache.org/event-driven-consumer.html";>Event Based 
Consumer</a>
      * returned by {@link #createConsumer(Processor)}
      *
+     * Important: Do not do any initialization in the constructor of the 
{@link PollingConsumer}.
+     * Instead use {@link ServiceSupport#doInit()} or {@link 
ServiceSupport#doStart()}.
+     *
      * @return           a newly created pull consumer
      * @throws Exception if the pull consumer could not be created
      */
diff --git a/core/camel-api/src/main/java/org/apache/camel/PollingConsumer.java 
b/core/camel-api/src/main/java/org/apache/camel/PollingConsumer.java
index d9d2dc1..cf68364 100644
--- a/core/camel-api/src/main/java/org/apache/camel/PollingConsumer.java
+++ b/core/camel-api/src/main/java/org/apache/camel/PollingConsumer.java
@@ -25,6 +25,10 @@ package org.apache.camel;
  * <p/>
  * This is needed to ensure any {@link org.apache.camel.spi.Synchronization} 
works is being executed. For example if you
  * consumed from a file endpoint, then the consumed file is only moved/delete 
when you done the {@link Exchange}.
+ * <p/>
+ * Important: Do not do any initialization in the constructor.
+ * Instead use {@link 
org.apache.camel.support.service.ServiceSupport#doInit()} or
+ * {@link org.apache.camel.support.service.ServiceSupport#doStart()}.
  */
 public interface PollingConsumer extends Consumer {
 
diff --git a/core/camel-api/src/main/java/org/apache/camel/Producer.java 
b/core/camel-api/src/main/java/org/apache/camel/Producer.java
index 1bfb4ae..e9c7605 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Producer.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Producer.java
@@ -17,7 +17,11 @@
 package org.apache.camel;
 
 /**
- * Provides a channel on which clients can create and invoke message exchanges 
on an {@link Endpoint}
+ * Provides a channel on which clients can create and invoke message exchanges 
on an {@link Endpoint}.
+ * <p/>
+ * Important: Do not do any initialization in the constructor.
+ * Instead use {@link 
org.apache.camel.support.service.ServiceSupport#doInit()} or
+ * {@link org.apache.camel.support.service.ServiceSupport#doStart()}.
  */
 public interface Producer extends Processor, Service, IsSingleton, 
EndpointAware {
 

Reply via email to