You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/12/28 11:17:40 UTC

[camel] 01/02: Avoid non singleton endpoints and polish code

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 def4fd07e48a805bb402a0543bd34a457e812b4f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Dec 28 12:11:44 2019 +0100

    Avoid non singleton endpoints and polish code
---
 .../component/ignite/AbstractIgniteEndpoint.java   | 13 ------------
 .../ignite/cache/IgniteCacheEndpoint.java          |  4 +++-
 .../ignite/compute/IgniteComputeEndpoint.java      | 24 ----------------------
 .../ignite/events/IgniteEventsEndpoint.java        |  4 ----
 .../ignite/idgen/IgniteIdGenEndpoint.java          | 16 ---------------
 .../ignite/messaging/IgniteMessagingEndpoint.java  | 16 ---------------
 .../ignite/queue/IgniteQueueEndpoint.java          | 20 ------------------
 .../component/ignite/set/IgniteSetEndpoint.java    | 12 -----------
 8 files changed, 3 insertions(+), 106 deletions(-)

diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteEndpoint.java
index b040fa4..9d31076 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteEndpoint.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/AbstractIgniteEndpoint.java
@@ -38,11 +38,6 @@ public abstract class AbstractIgniteEndpoint extends DefaultEndpoint {
         super(endpointUri, component);
     }
 
-    @Override
-    public boolean isSingleton() {
-        return false;
-    }
-
     protected AbstractIgniteComponent igniteComponent() {
         if (component == null) {
             component = (AbstractIgniteComponent) getComponent();
@@ -57,8 +52,6 @@ public abstract class AbstractIgniteEndpoint extends DefaultEndpoint {
     /**
      * Gets whether to propagate the incoming body if the return type of the underlying 
      * Ignite operation is void.
-     * 
-     * @return
      */
     public boolean isPropagateIncomingBodyIfNoReturnValue() {
         return propagateIncomingBodyIfNoReturnValue;
@@ -67,8 +60,6 @@ public abstract class AbstractIgniteEndpoint extends DefaultEndpoint {
     /**
      * Sets whether to propagate the incoming body if the return type of the underlying 
      * Ignite operation is void.
-     * 
-     * @param propagateIncomingBodyIfNoReturnValue
      */
     public void setPropagateIncomingBodyIfNoReturnValue(boolean propagateIncomingBodyIfNoReturnValue) {
         this.propagateIncomingBodyIfNoReturnValue = propagateIncomingBodyIfNoReturnValue;
@@ -77,8 +68,6 @@ public abstract class AbstractIgniteEndpoint extends DefaultEndpoint {
     /**
      * Gets whether to treat Collections as cache objects or as Collections of items to 
      * insert/update/compute, etc.
-     * 
-     * @return
      */
     public boolean isTreatCollectionsAsCacheObjects() {
         return treatCollectionsAsCacheObjects;
@@ -87,8 +76,6 @@ public abstract class AbstractIgniteEndpoint extends DefaultEndpoint {
     /**
      * Sets whether to treat Collections as cache objects or as Collections of items to 
      * insert/update/compute, etc.
-     * 
-     * @param treatCollectionsAsCacheObjects
      */
     public void setTreatCollectionsAsCacheObjects(boolean treatCollectionsAsCacheObjects) {
         this.treatCollectionsAsCacheObjects = treatCollectionsAsCacheObjects;
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheEndpoint.java
index 8126a9b..d654f57 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheEndpoint.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheEndpoint.java
@@ -89,7 +89,9 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint {
 
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
-        return new IgniteCacheContinuousQueryConsumer(this, processor, obtainCache());
+        Consumer consumer = new IgniteCacheContinuousQueryConsumer(this, processor, obtainCache());
+        configureConsumer(consumer);
+        return consumer;
     }
 
     private IgniteCache<Object, Object> obtainCache() throws CamelException {
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeEndpoint.java
index 320f338..04e7269 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeEndpoint.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeEndpoint.java
@@ -89,8 +89,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the endpoint ID.
-     * 
-     * @return endpoint ID (not used)
      */
     public String getEndpointId() {
         return endpointId;
@@ -98,8 +96,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The endpoint ID (not used).
-     * 
-     * @param endpointId endpoint ID (not used)
      */
     public void setEndpointId(String endpointId) {
         this.endpointId = endpointId;
@@ -107,8 +103,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the cluster group expression.
-     * 
-     * @return cluster group expression
      */
     public ClusterGroupExpression getClusterGroupExpression() {
         return clusterGroupExpression;
@@ -116,8 +110,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * An expression that returns the Cluster Group for the IgniteCompute instance.
-     * 
-     * @param clusterGroupExpression cluster group expression
      */
     public void setClusterGroupExpression(ClusterGroupExpression clusterGroupExpression) {
         this.clusterGroupExpression = clusterGroupExpression;
@@ -125,8 +117,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the execution type of this producer.
-     * 
-     * @return
      */
     public IgniteComputeExecutionType getExecutionType() {
         return executionType;
@@ -136,8 +126,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
      * The compute operation to perform. Possible values: CALL, BROADCAST, APPLY,
      *  EXECUTE, RUN, AFFINITY_CALL, AFFINITY_RUN.
      * The component expects different payload types depending on the operation.
-     * 
-     * @param executionType
      */
     public void setExecutionType(IgniteComputeExecutionType executionType) {
         this.executionType = executionType;
@@ -145,8 +133,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the task name, only applicable if using the {@link IgniteComputeExecutionType#EXECUTE} execution type.
-     * 
-     * @return
      */
     public String getTaskName() {
         return taskName;
@@ -154,8 +140,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The task name, only applicable if using the {@link IgniteComputeExecutionType#EXECUTE} execution type.
-     * 
-     * @param taskName
      */
     public void setTaskName(String taskName) {
         this.taskName = taskName;
@@ -163,8 +147,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the name of the compute job, which will be set via {@link IgniteCompute#withName(String)}. 
-     * 
-     * @return
      */
     public String getComputeName() {
         return computeName;
@@ -172,8 +154,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The name of the compute job, which will be set via {@link IgniteCompute#withName(String)}.
-     * 
-     * @param computeName
      */
     public void setComputeName(String computeName) {
         this.computeName = computeName;
@@ -181,8 +161,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the timeout interval for triggered jobs, in milliseconds, which will be set via {@link IgniteCompute#withTimeout(long)}.
-     * 
-     * @return
      */
     public Long getTimeoutMillis() {
         return timeoutMillis;
@@ -190,8 +168,6 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The timeout interval for triggered jobs, in milliseconds, which will be set via {@link IgniteCompute#withTimeout(long)}.
-     * 
-     * @param timeoutMillis
      */
     public void setTimeoutMillis(Long timeoutMillis) {
         this.timeoutMillis = timeoutMillis;
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java
index 5d76301..b173b09 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java
@@ -94,8 +94,6 @@ public class IgniteEventsEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the endpoint ID (not used).
-     * 
-     * @return endpoint ID (not used)
      */
     public String getEndpointId() {
         return endpointId;
@@ -103,8 +101,6 @@ public class IgniteEventsEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The endpoint ID (not used).
-     * 
-     * @param endpointId endpoint ID (not used)
      */
     public void setEndpointId(String endpointId) {
         this.endpointId = endpointId;
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenEndpoint.java
index 9c2f958..d05dafb 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenEndpoint.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenEndpoint.java
@@ -80,8 +80,6 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the name.
-     * 
-     * @return name
      */
     public String getName() {
         return name;
@@ -89,8 +87,6 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The sequence name.
-     * 
-     * @param name name
      */
     public void setName(String name) {
         this.name = name;
@@ -98,8 +94,6 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the initial value.
-     * 
-     * @return initial value
      */
     public Long getInitialValue() {
         return initialValue;
@@ -107,8 +101,6 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The initial value.
-     * 
-     * @param initialValue initial value
      */
     public void setInitialValue(Long initialValue) {
         this.initialValue = initialValue;
@@ -116,8 +108,6 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the operation.
-     * 
-     * @return operation
      */
     public IgniteIdGenOperation getOperation() {
         return operation;
@@ -127,8 +117,6 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint {
      * The operation to invoke on the Ignite ID Generator.
      * Superseded by the IgniteConstants.IGNITE_IDGEN_OPERATION header in the IN message.
      * Possible values: ADD_AND_GET, GET, GET_AND_ADD, GET_AND_INCREMENT, INCREMENT_AND_GET.
-     * 
-     * @param operation operation
      */
     public void setOperation(IgniteIdGenOperation operation) {
         this.operation = operation;
@@ -136,8 +124,6 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the batch size.
-     * 
-     * @return batch size
      */
     public Integer getBatchSize() {
         return batchSize;
@@ -145,8 +131,6 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The batch size.
-     * 
-     * @param batchSize batch size
      */
     public void setBatchSize(Integer batchSize) {
         this.batchSize = batchSize;
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingEndpoint.java
index b3925ec..b3ead2e 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingEndpoint.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingEndpoint.java
@@ -94,8 +94,6 @@ public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the topic name.
-     * 
-     * @return topic name
      */
     public String getTopic() {
         return topic;
@@ -103,8 +101,6 @@ public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The topic name.
-     * 
-     * @param topic topic name
      */
     public void setTopic(String topic) {
         this.topic = topic;
@@ -112,8 +108,6 @@ public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the cluster group expression.
-     * 
-     * @return cluster group expression
      */
     public ClusterGroupExpression getClusterGroupExpression() {
         return clusterGroupExpression;
@@ -121,8 +115,6 @@ public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The cluster group expression.
-     * 
-     * @param clusterGroupExpression cluster group expression
      */
     public void setClusterGroupExpression(ClusterGroupExpression clusterGroupExpression) {
         this.clusterGroupExpression = clusterGroupExpression;
@@ -130,8 +122,6 @@ public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the timeout.
-     * 
-     * @return timeout
      */
     public Long getTimeout() {
         return timeout;
@@ -139,8 +129,6 @@ public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The timeout for the send operation when using ordered messages.
-     * 
-     * @param timeout timeout
      */
     public void setTimeout(Long timeout) {
         this.timeout = timeout;
@@ -148,8 +136,6 @@ public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the send mode.
-     * 
-     * @return send mode
      */
     public IgniteMessagingSendMode getSendMode() {
         return sendMode;
@@ -158,8 +144,6 @@ public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint {
     /**
      * The send mode to use.
      * Possible values: UNORDERED, ORDERED.
-     * 
-     * @param sendMode send mode
      */
     public void setSendMode(IgniteMessagingSendMode sendMode) {
         this.sendMode = sendMode;
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java
index 845edfb..e53196a 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java
@@ -82,8 +82,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the queue name.
-     * 
-     * @return
      */
     public String getName() {
         return name;
@@ -91,8 +89,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The queue name.
-     * 
-     * @param name
      */
     public void setName(String name) {
         this.name = name;
@@ -100,8 +96,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the queue operation to perform.
-     * 
-     * @return
      */
     public IgniteQueueOperation getOperation() {
         return operation;
@@ -111,8 +105,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
      * The operation to invoke on the Ignite Queue.
      * Superseded by the IgniteConstants.IGNITE_QUEUE_OPERATION header in the IN message.
      * Possible values: CONTAINS, ADD, SIZE, REMOVE, ITERATOR, CLEAR, RETAIN_ALL, ARRAY, DRAIN, ELEMENT, PEEK, OFFER, POLL, TAKE, PUT.
-     * 
-     * @param operation
      */
     public void setOperation(IgniteQueueOperation operation) {
         this.operation = operation;
@@ -120,8 +112,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the queue capacity. Default: non-bounded.
-     * 
-     * @return
      */
     public int getCapacity() {
         return capacity;
@@ -129,8 +119,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The queue capacity. Default: non-bounded.
-     * 
-     * @param capacity
      */
     public void setCapacity(int capacity) {
         this.capacity = capacity;
@@ -138,8 +126,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the collection configuration. Default: empty configuration.
-     * 
-     * @return
      */
     public CollectionConfiguration getConfiguration() {
         return configuration;
@@ -149,8 +135,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
      * The collection configuration. Default: empty configuration.
      * <p>
      * You can also conveniently set inner properties by using <tt>configuration.xyz=123</tt> options.
-     * 
-     * @param configuration
      */
     public void setConfiguration(CollectionConfiguration configuration) {
         this.configuration = configuration;
@@ -158,8 +142,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the queue timeout in milliseconds. Default: no timeout.
-     * 
-     * @return
      */
     public Long getTimeoutMillis() {
         return timeoutMillis;
@@ -167,8 +149,6 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The queue timeout in milliseconds. Default: no timeout.
-     * 
-     * @param timeoutMillis
      */
     public void setTimeoutMillis(Long timeoutMillis) {
         this.timeoutMillis = timeoutMillis;
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java
index 1c6b1a6..b60b972 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java
@@ -73,8 +73,6 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the set name.
-     * 
-     * @return
      */
     public String getName() {
         return name;
@@ -82,8 +80,6 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * The set name.
-     * 
-     * @param name
      */
     public void setName(String name) {
         this.name = name;
@@ -91,8 +87,6 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the collection configuration. Default: empty configuration.
-     * 
-     * @return
      */
     public CollectionConfiguration getConfiguration() {
         return configuration;
@@ -102,8 +96,6 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint {
      * The collection configuration. Default: empty configuration.
      * <p>
      * You can also conveniently set inner properties by using <tt>configuration.xyz=123</tt> options.
-     * 
-     * @param configuration
      */
     public void setConfiguration(CollectionConfiguration configuration) {
         this.configuration = configuration;
@@ -111,8 +103,6 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint {
 
     /**
      * Gets the set operation to perform.
-     * 
-     * @return
      */
     public IgniteSetOperation getOperation() {
         return operation;
@@ -122,8 +112,6 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint {
      * The operation to invoke on the Ignite Set.
      * Superseded by the IgniteConstants.IGNITE_SETS_OPERATION header in the IN message.
      * Possible values: CONTAINS, ADD, SIZE, REMOVE, ITERATOR, CLEAR, RETAIN_ALL, ARRAY.The set operation to perform.
-     * 
-     * @param operation
      */
     public void setOperation(IgniteSetOperation operation) {
         this.operation = operation;