You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2021/07/19 09:57:25 UTC
[camel] branch main updated: (chores) camel-ignite: code cleanups
(#5845)
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new affaa38 (chores) camel-ignite: code cleanups (#5845)
affaa38 is described below
commit affaa38716e4945d2edd6aab89bbf84cfa270490
Author: Otavio Rodolfo Piske <or...@users.noreply.github.com>
AuthorDate: Mon Jul 19 11:56:12 2021 +0200
(chores) camel-ignite: code cleanups (#5845)
- Avoid shadowing variables
- Remove unused variables
- Use specific exceptions where possible
- Use log markers
---
.../cache/IgniteCacheContinuousQueryConsumer.java | 4 +--
.../ignite/compute/IgniteComputeProducer.java | 30 +++++++++++-----------
.../ignite/events/IgniteEventsEndpoint.java | 14 +++++-----
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheContinuousQueryConsumer.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheContinuousQueryConsumer.java
index 4e3e9c5..04bc639 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheContinuousQueryConsumer.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheContinuousQueryConsumer.java
@@ -68,11 +68,11 @@ public class IgniteCacheContinuousQueryConsumer extends DefaultConsumer {
private void maybeFireExistingQueryResults() {
if (!endpoint.isFireExistingQueryResults()) {
- LOG.info(String.format("Skipping existing cache results for cache name = %s.", endpoint.getCacheName()));
+ LOG.info("Skipping existing cache results for cache name = {}.", endpoint.getCacheName());
return;
}
- LOG.info(String.format("Processing existing cache results for cache name = %s.", endpoint.getCacheName()));
+ LOG.info("Processing existing cache results for cache name = {}.", endpoint.getCacheName());
for (Entry<Object, Object> entry : cursor) {
Exchange exchange = createExchange(entry.getValue());
diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeProducer.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeProducer.java
index ce7e2ee..7cd196b 100644
--- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeProducer.java
+++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeProducer.java
@@ -22,6 +22,7 @@ import java.util.Collection;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
+import org.apache.camel.NoTypeConversionAvailableException;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.TypeConverter;
import org.apache.camel.component.ignite.IgniteConstants;
@@ -56,31 +57,31 @@ public class IgniteComputeProducer extends DefaultAsyncProducer {
switch (executionTypeFor(exchange)) {
case CALL:
- doCall(exchange, callback, compute);
+ doCall(exchange, compute);
break;
case BROADCAST:
- doBroadcast(exchange, callback, compute);
+ doBroadcast(exchange, compute);
break;
case EXECUTE:
- doExecute(exchange, callback, compute);
+ doExecute(exchange, compute);
break;
case RUN:
- doRun(exchange, callback, compute);
+ doRun(exchange, compute);
break;
case APPLY:
- doApply(exchange, callback, compute);
+ doApply(exchange, compute);
break;
case AFFINITY_CALL:
- doAffinityCall(exchange, callback, compute);
+ doAffinityCall(exchange, compute);
break;
case AFFINITY_RUN:
- doAffinityRun(exchange, callback, compute);
+ doAffinityRun(exchange, compute);
break;
default:
@@ -101,7 +102,7 @@ public class IgniteComputeProducer extends DefaultAsyncProducer {
}
@SuppressWarnings({ "unchecked", "rawtypes" })
- private void doCall(final Exchange exchange, final AsyncCallback callback, IgniteCompute compute) throws Exception {
+ private void doCall(final Exchange exchange, IgniteCompute compute) throws NoTypeConversionAvailableException {
Object job = exchange.getIn().getBody();
IgniteReducer<Object, Object> reducer
= exchange.getIn().getHeader(IgniteConstants.IGNITE_COMPUTE_REDUCER, IgniteReducer.class);
@@ -130,7 +131,7 @@ public class IgniteComputeProducer extends DefaultAsyncProducer {
}
@SuppressWarnings("unchecked")
- private void doBroadcast(final Exchange exchange, final AsyncCallback callback, IgniteCompute compute) throws Exception {
+ private void doBroadcast(final Exchange exchange, IgniteCompute compute) {
Object job = exchange.getIn().getBody();
if (IgniteCallable.class.isAssignableFrom(job.getClass())) {
@@ -149,7 +150,7 @@ public class IgniteComputeProducer extends DefaultAsyncProducer {
}
@SuppressWarnings("unchecked")
- private void doExecute(final Exchange exchange, final AsyncCallback callback, IgniteCompute compute) throws Exception {
+ private void doExecute(final Exchange exchange, IgniteCompute compute) {
Object job = exchange.getIn().getBody();
Object params = exchange.getIn().getHeader(IgniteConstants.IGNITE_COMPUTE_PARAMS);
@@ -172,7 +173,7 @@ public class IgniteComputeProducer extends DefaultAsyncProducer {
}
}
- private void doRun(final Exchange exchange, final AsyncCallback callback, IgniteCompute compute) throws Exception {
+ private void doRun(final Exchange exchange, IgniteCompute compute) throws NoTypeConversionAvailableException {
Object job = exchange.getIn().getBody();
if (Collection.class.isAssignableFrom(job.getClass())) {
@@ -195,8 +196,7 @@ public class IgniteComputeProducer extends DefaultAsyncProducer {
}
@SuppressWarnings("unchecked")
- private <T, R1, R2> void doApply(final Exchange exchange, final AsyncCallback callback, IgniteCompute compute)
- throws Exception {
+ private <T, R1, R2> void doApply(final Exchange exchange, IgniteCompute compute) {
IgniteClosure<T, R1> job = exchange.getIn().getBody(IgniteClosure.class);
T params = (T) exchange.getIn().getHeader(IgniteConstants.IGNITE_COMPUTE_PARAMS);
@@ -222,7 +222,7 @@ public class IgniteComputeProducer extends DefaultAsyncProducer {
}
@SuppressWarnings("unchecked")
- private void doAffinityCall(final Exchange exchange, final AsyncCallback callback, IgniteCompute compute) throws Exception {
+ private void doAffinityCall(final Exchange exchange, IgniteCompute compute) {
IgniteCallable<Object> job = exchange.getIn().getBody(IgniteCallable.class);
String affinityCache = exchange.getIn().getHeader(IgniteConstants.IGNITE_COMPUTE_AFFINITY_CACHE_NAME, String.class);
Object affinityKey = exchange.getIn().getHeader(IgniteConstants.IGNITE_COMPUTE_AFFINITY_KEY, Object.class);
@@ -238,7 +238,7 @@ public class IgniteComputeProducer extends DefaultAsyncProducer {
compute.affinityCall(affinityCache, affinityKey, job);
}
- private void doAffinityRun(final Exchange exchange, final AsyncCallback callback, IgniteCompute compute) throws Exception {
+ private void doAffinityRun(final Exchange exchange, IgniteCompute compute) {
IgniteRunnable job = exchange.getIn().getBody(IgniteRunnable.class);
String affinityCache = exchange.getIn().getHeader(IgniteConstants.IGNITE_COMPUTE_AFFINITY_CACHE_NAME, String.class);
Object affinityKey = exchange.getIn().getHeader(IgniteConstants.IGNITE_COMPUTE_AFFINITY_KEY, Object.class);
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 eb30100..174405a 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
@@ -76,27 +76,27 @@ public class IgniteEventsEndpoint extends AbstractIgniteEndpoint {
@Override
public Consumer createConsumer(Processor processor) throws Exception {
// Initialize the Consumer.
- IgniteEvents events = createIgniteEvents();
- IgniteEventsConsumer consumer = new IgniteEventsConsumer(this, processor, events);
+ IgniteEvents igniteEvents = createIgniteEvents();
+ IgniteEventsConsumer consumer = new IgniteEventsConsumer(this, processor, igniteEvents);
configureConsumer(consumer);
- LOG.info("Created Ignite Events consumer for event types: {}.", events);
+ LOG.info("Created Ignite Events consumer for event types: {}.", igniteEvents);
return consumer;
}
private IgniteEvents createIgniteEvents() {
Ignite ignite = ignite();
- IgniteEvents events;
+ IgniteEvents igniteEvents;
if (clusterGroupExpression == null) {
LOG.info("Ignite Events endpoint for event types {} using no Cluster Group.", this.events);
- events = ignite.events();
+ igniteEvents = ignite.events();
} else {
ClusterGroup group = clusterGroupExpression.getClusterGroup(ignite);
LOG.info("Ignite Events endpoint for event types {} using Cluster Group: {}.", this.events, group);
- events = ignite.events(group);
+ igniteEvents = ignite.events(group);
}
- return events;
+ return igniteEvents;
}
/**