You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ch...@apache.org on 2007/08/07 20:36:08 UTC
svn commit: r563607 [8/12] - in /activemq/camel/trunk/camel-core/src:
main/java/org/apache/camel/ main/java/org/apache/camel/builder/
main/java/org/apache/camel/builder/xml/
main/java/org/apache/camel/component/bean/
main/java/org/apache/camel/componen...
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -26,36 +25,38 @@
import org.apache.commons.logging.LogFactory;
/**
- * Implements a
- * <a href="http://activemq.apache.org/camel/dead-letter-channel.html">Dead Letter Channel</a>
- * after attempting to redeliver the message using the {@link RedeliveryPolicy}
- *
+ * Implements a <a
+ * href="http://activemq.apache.org/camel/dead-letter-channel.html">Dead Letter
+ * Channel</a> after attempting to redeliver the message using the
+ * {@link RedeliveryPolicy}
+ *
* @version $Revision$
*/
public class DeadLetterChannel extends ServiceSupport implements ErrorHandler {
public static final String REDELIVERY_COUNTER = "org.apache.camel.RedeliveryCounter";
public static final String REDELIVERED = "org.apache.camel.Redelivered";
- private static final transient Log log = LogFactory.getLog(DeadLetterChannel.class);
+ private static final transient Log LOG = LogFactory.getLog(DeadLetterChannel.class);
private Processor output;
private Processor deadLetter;
private RedeliveryPolicy redeliveryPolicy;
private Logger logger;
- public static <E extends Exchange> Logger createDefaultLogger() {
- return new Logger(log, LoggingLevel.ERROR);
- }
-
public DeadLetterChannel(Processor output, Processor deadLetter) {
this(output, deadLetter, new RedeliveryPolicy(), DeadLetterChannel.createDefaultLogger());
}
- public DeadLetterChannel(Processor output, Processor deadLetter, RedeliveryPolicy redeliveryPolicy, Logger logger) {
+ public DeadLetterChannel(Processor output, Processor deadLetter, RedeliveryPolicy redeliveryPolicy,
+ Logger logger) {
this.deadLetter = deadLetter;
this.output = output;
this.redeliveryPolicy = redeliveryPolicy;
this.logger = logger;
}
+
+ public static <E extends Exchange> Logger createDefaultLogger() {
+ return new Logger(LOG, LoggingLevel.ERROR);
+ }
@Override
public String toString() {
@@ -76,20 +77,18 @@
try {
output.process(exchange);
return;
- }
- catch (RuntimeException e) {
+ } catch (RuntimeException e) {
logger.log("On delivery attempt: " + redeliveryCounter + " caught: " + e, e);
}
redeliveryCounter = incrementRedeliveryCounter(exchange);
- }
- while (redeliveryPolicy.shouldRedeliver(redeliveryCounter));
+ } while (redeliveryPolicy.shouldRedeliver(redeliveryCounter));
// now lets send to the dead letter queue
deadLetter.process(exchange);
}
// Properties
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
/**
* Returns the output processor
@@ -99,7 +98,8 @@
}
/**
- * Returns the dead letter that message exchanges will be sent to if the redelivery attempts fail
+ * Returns the dead letter that message exchanges will be sent to if the
+ * redelivery attempts fail
*/
public Processor getDeadLetter() {
return deadLetter;
@@ -121,17 +121,19 @@
}
/**
- * Sets the logger strategy; which {@link Log} to use and which {@link LoggingLevel} to use
+ * Sets the logger strategy; which {@link Log} to use and which
+ * {@link LoggingLevel} to use
*/
public void setLogger(Logger logger) {
this.logger = logger;
}
// Implementation methods
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
/**
- * Increments the redelivery counter and adds the redelivered flag if the message has been redelivered
+ * Increments the redelivery counter and adds the redelivered flag if the
+ * message has been redelivered
*/
protected int incrementRedeliveryCounter(Exchange exchange) {
Message in = exchange.getIn();
@@ -147,15 +149,14 @@
protected void sleep(long redeliveryDelay) {
if (redeliveryDelay > 0) {
- if (log.isDebugEnabled()) {
- log.debug("Sleeping for: " + redeliveryDelay + " until attempting redelivery");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Sleeping for: " + redeliveryDelay + " until attempting redelivery");
}
try {
Thread.sleep(redeliveryDelay);
- }
- catch (InterruptedException e) {
- if (log.isDebugEnabled()) {
- log.debug("Thread interupted: " + e, e);
+ } catch (InterruptedException e) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Thread interupted: " + e, e);
}
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java Tue Aug 7 11:35:48 2007
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -16,23 +16,23 @@
*/
package org.apache.camel.processor;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
import org.apache.camel.AlreadyStoppedException;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
/**
* A useful base class for any processor which provides some kind of throttling
* or delayed processing
- *
+ *
* @version $Revision: $
*/
public abstract class DelayProcessorSupport extends DelegateProcessor {
- private static final transient Log log = LogFactory.getLog(Delayer.class);
+ private static final transient Log LOG = LogFactory.getLog(Delayer.class);
private CountDownLatch stoppedLatch = new CountDownLatch(1);
private boolean fastStop = true;
@@ -52,8 +52,8 @@
/**
* Enables & disables a fast stop; basically to avoid waiting a possibly
* long time for delays to complete before the context shuts down; instead
- * the current processing method throws {@link org.apache.camel.AlreadyStoppedException}
- * to terminate processing.
+ * the current processing method throws
+ * {@link org.apache.camel.AlreadyStoppedException} to terminate processing.
*/
public void setFastStop(boolean fastStop) {
this.fastStop = fastStop;
@@ -68,8 +68,8 @@
/**
* Wait until the given system time before continuing
- *
- * @param time the system time to wait for
+ *
+ * @param time the system time to wait for
* @param exchange the exchange being processed
*/
protected void waitUntil(long time, Exchange exchange) throws Exception {
@@ -77,15 +77,13 @@
long delay = time - currentSystemTime();
if (delay < 0) {
return;
- }
- else {
+ } else {
if (isFastStop() && (isStopped() || isStopping())) {
throw new AlreadyStoppedException();
}
try {
sleep(delay);
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
handleSleepInteruptedException(e);
}
}
@@ -93,22 +91,22 @@
}
protected void sleep(long delay) throws InterruptedException {
- if (log.isDebugEnabled()) {
- log.debug("Sleeping for: " + delay + " millis");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Sleeping for: " + delay + " millis");
}
if (isFastStop()) {
stoppedLatch.await(delay, TimeUnit.MILLISECONDS);
- }
- else {
+ } else {
Thread.sleep(delay);
}
}
/**
- * Called when a sleep is interupted; allows derived classes to handle this case differently
+ * Called when a sleep is interupted; allows derived classes to handle this
+ * case differently
*/
protected void handleSleepInteruptedException(InterruptedException e) {
- log.debug("Sleep interupted: " + e, e);
+ LOG.debug("Sleep interupted: " + e, e);
}
protected long currentSystemTime() {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Delayer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Delayer.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Delayer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Delayer.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,18 +22,18 @@
import org.apache.camel.util.ExpressionHelper;
/**
- * A <a href="http://activemq.apache.org/camel/delayer.html">Delayer</a> which delays
- * processing the exchange until the correct amount of time has elapsed
- * using an expression to determine the delivery time.
- * <p/>
- * For example if you wish to delay JMS messages by 25 seconds from their publish time you could create
- * an instance of this class with the expression <code>header("JMSTimestamp")</code> and a delay value of 25000L.
- *
+ * A <a href="http://activemq.apache.org/camel/delayer.html">Delayer</a> which
+ * delays processing the exchange until the correct amount of time has elapsed
+ * using an expression to determine the delivery time. <p/> For example if you
+ * wish to delay JMS messages by 25 seconds from their publish time you could
+ * create an instance of this class with the expression
+ * <code>header("JMSTimestamp")</code> and a delay value of 25000L.
+ *
* @version $Revision: 1.1 $
*/
public class Delayer extends DelayProcessorSupport {
private Expression<Exchange> timeExpression;
- private long delay = 0L;
+ private long delay;
public Delayer(Processor processor, Expression<Exchange> timeExpression, long delay) {
super(processor);
@@ -48,24 +47,25 @@
}
// Properties
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
public long getDelay() {
return delay;
}
/**
- * Sets the delay from the publish time; which is typically the time from the expression
- * or the current system time if none is available
+ * Sets the delay from the publish time; which is typically the time from
+ * the expression or the current system time if none is available
*/
public void setDelay(long delay) {
this.delay = delay;
}
// Implementation methods
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
/**
- * Waits for an optional time period before continuing to process the exchange
+ * Waits for an optional time period before continuing to process the
+ * exchange
*/
protected void delay(Exchange exchange) throws Exception {
long time = 0;
@@ -85,9 +85,9 @@
}
/**
- * A Strategy Method to allow derived implementations to decide the current system time or some other
- * default exchange property
- *
+ * A Strategy Method to allow derived implementations to decide the current
+ * system time or some other default exchange property
+ *
* @param exchange
*/
protected long defaultProcessTime(Exchange exchange) {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -20,13 +19,12 @@
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.impl.ServiceSupport;
-import org.apache.camel.spi.Policy;
import org.apache.camel.util.ServiceHelper;
/**
- * A Delegate pattern which delegates processing to a nested processor which can be useful for implementation inheritence
- * when writing an {@link Policy}
- *
+ * A Delegate pattern which delegates processing to a nested processor which can
+ * be useful for implementation inheritance when writing an {@link Policy}
+ *
* @version $Revision: 519941 $
*/
public class DelegateProcessor extends ServiceSupport implements Processor {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ErrorHandler.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ErrorHandler.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ErrorHandler.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ErrorHandler.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Logger.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Logger.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Logger.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Logger.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,9 +22,9 @@
import org.apache.commons.logging.LogFactory;
/**
- * A {@link Processor} which just logs to a {@link Log} object which can be used as an exception
- * handler instead of using a dead letter queue.
- *
+ * A {@link Processor} which just logs to a {@link Log} object which can be used
+ * as an exception handler instead of using a dead letter queue.
+ *
* @version $Revision$
*/
public class Logger implements Processor {
@@ -60,112 +59,112 @@
public void process(Exchange exchange) {
switch (level) {
- case DEBUG:
- if (log.isDebugEnabled()) {
- log.debug(logMessage(exchange));
- }
- break;
- case ERROR:
- if (log.isErrorEnabled()) {
- log.error(logMessage(exchange));
- }
- break;
- case FATAL:
- if (log.isFatalEnabled()) {
- log.fatal(logMessage(exchange));
- }
- break;
- case INFO:
- if (log.isInfoEnabled()) {
- log.info(logMessage(exchange));
- }
- break;
- case TRACE:
- if (log.isTraceEnabled()) {
- log.trace(logMessage(exchange));
- }
- break;
- case WARN:
- if (log.isWarnEnabled()) {
- log.warn(logMessage(exchange));
- }
- break;
- default:
- log.error("Unknown level: " + level + " when trying to log exchange: " + logMessage(exchange));
+ case DEBUG:
+ if (log.isDebugEnabled()) {
+ log.debug(logMessage(exchange));
+ }
+ break;
+ case ERROR:
+ if (log.isErrorEnabled()) {
+ log.error(logMessage(exchange));
+ }
+ break;
+ case FATAL:
+ if (log.isFatalEnabled()) {
+ log.fatal(logMessage(exchange));
+ }
+ break;
+ case INFO:
+ if (log.isInfoEnabled()) {
+ log.info(logMessage(exchange));
+ }
+ break;
+ case TRACE:
+ if (log.isTraceEnabled()) {
+ log.trace(logMessage(exchange));
+ }
+ break;
+ case WARN:
+ if (log.isWarnEnabled()) {
+ log.warn(logMessage(exchange));
+ }
+ break;
+ default:
+ log.error("Unknown level: " + level + " when trying to log exchange: " + logMessage(exchange));
}
}
public void log(String message) {
switch (level) {
- case DEBUG:
- if (log.isDebugEnabled()) {
- log.debug(message);
- }
- break;
- case ERROR:
- if (log.isErrorEnabled()) {
- log.error(message);
- }
- break;
- case FATAL:
- if (log.isFatalEnabled()) {
- log.fatal(message);
- }
- break;
- case INFO:
- if (log.isInfoEnabled()) {
- log.debug(message);
- }
- break;
- case TRACE:
- if (log.isTraceEnabled()) {
- log.trace(message);
- }
- break;
- case WARN:
- if (log.isWarnEnabled()) {
- log.warn(message);
- }
- break;
- default:
- log.error("Unknown level: " + level + " when trying to log exchange: " + message);
+ case DEBUG:
+ if (log.isDebugEnabled()) {
+ log.debug(message);
+ }
+ break;
+ case ERROR:
+ if (log.isErrorEnabled()) {
+ log.error(message);
+ }
+ break;
+ case FATAL:
+ if (log.isFatalEnabled()) {
+ log.fatal(message);
+ }
+ break;
+ case INFO:
+ if (log.isInfoEnabled()) {
+ log.debug(message);
+ }
+ break;
+ case TRACE:
+ if (log.isTraceEnabled()) {
+ log.trace(message);
+ }
+ break;
+ case WARN:
+ if (log.isWarnEnabled()) {
+ log.warn(message);
+ }
+ break;
+ default:
+ log.error("Unknown level: " + level + " when trying to log exchange: " + message);
}
}
public void log(String message, Throwable exception) {
switch (level) {
- case DEBUG:
- if (log.isDebugEnabled()) {
- log.debug(message, exception);
- }
- break;
- case ERROR:
- if (log.isErrorEnabled()) {
- log.error(message, exception);
- }
- break;
- case FATAL:
- if (log.isFatalEnabled()) {
- log.fatal(message, exception);
- }
- break;
- case INFO:
- if (log.isInfoEnabled()) {
- log.debug(message, exception);
- }
- break;
- case TRACE:
- if (log.isTraceEnabled()) {
- log.trace(message, exception);
- }
- break;
- case WARN:
- if (log.isWarnEnabled()) {
- log.warn(message, exception);
- }
- break;
- default:
- log.error("Unknown level: " + level + " when trying to log exchange: " + message, exception);
+ case DEBUG:
+ if (log.isDebugEnabled()) {
+ log.debug(message, exception);
+ }
+ break;
+ case ERROR:
+ if (log.isErrorEnabled()) {
+ log.error(message, exception);
+ }
+ break;
+ case FATAL:
+ if (log.isFatalEnabled()) {
+ log.fatal(message, exception);
+ }
+ break;
+ case INFO:
+ if (log.isInfoEnabled()) {
+ log.debug(message, exception);
+ }
+ break;
+ case TRACE:
+ if (log.isTraceEnabled()) {
+ log.trace(message, exception);
+ }
+ break;
+ case WARN:
+ if (log.isWarnEnabled()) {
+ log.warn(message, exception);
+ }
+ break;
+ default:
+ log.error("Unknown level: " + level + " when trying to log exchange: " + message, exception);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoggingErrorHandler.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoggingErrorHandler.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoggingErrorHandler.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoggingErrorHandler.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -26,7 +25,7 @@
/**
* An {@link ErrorHandler} which uses commons-logging to dump the error
- *
+ *
* @version $Revision$
*/
public class LoggingErrorHandler extends ServiceSupport implements ErrorHandler {
@@ -52,14 +51,13 @@
public void process(Exchange exchange) throws Exception {
try {
output.process(exchange);
- }
- catch (RuntimeException e) {
+ } catch (RuntimeException e) {
logError(exchange, e);
}
}
// Properties
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
/**
* Returns the output processor
@@ -85,41 +83,42 @@
}
// Implementation methods
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
protected void logError(Exchange exchange, RuntimeException e) {
switch (level) {
- case DEBUG:
- if (log.isDebugEnabled()) {
- log.debug(logMessage(exchange, e), e);
- }
- break;
- case ERROR:
- if (log.isErrorEnabled()) {
- log.error(logMessage(exchange, e), e);
- }
- break;
- case FATAL:
- if (log.isFatalEnabled()) {
- log.fatal(logMessage(exchange, e), e);
- }
- break;
- case INFO:
- if (log.isInfoEnabled()) {
- log.debug(logMessage(exchange, e), e);
- }
- break;
- case TRACE:
- if (log.isTraceEnabled()) {
- log.trace(logMessage(exchange, e), e);
- }
- break;
- case WARN:
- if (log.isWarnEnabled()) {
- log.warn(logMessage(exchange, e), e);
- }
- break;
- default:
- log.error("Unknown level: " + level + " when trying to log exchange: " + logMessage(exchange, e), e);
+ case DEBUG:
+ if (log.isDebugEnabled()) {
+ log.debug(logMessage(exchange, e), e);
+ }
+ break;
+ case ERROR:
+ if (log.isErrorEnabled()) {
+ log.error(logMessage(exchange, e), e);
+ }
+ break;
+ case FATAL:
+ if (log.isFatalEnabled()) {
+ log.fatal(logMessage(exchange, e), e);
+ }
+ break;
+ case INFO:
+ if (log.isInfoEnabled()) {
+ log.debug(logMessage(exchange, e), e);
+ }
+ break;
+ case TRACE:
+ if (log.isTraceEnabled()) {
+ log.trace(logMessage(exchange, e), e);
+ }
+ break;
+ case WARN:
+ if (log.isWarnEnabled()) {
+ log.warn(logMessage(exchange, e), e);
+ }
+ break;
+ default:
+ log.error("Unknown level: " + level + " when trying to log exchange: " + logMessage(exchange, e),
+ e);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoggingLevel.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoggingLevel.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoggingLevel.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoggingLevel.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,30 +16,34 @@
*/
package org.apache.camel.processor;
+import java.util.ArrayList;
+import java.util.Collection;
+
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.util.ServiceHelper;
import org.apache.camel.impl.ServiceSupport;
-
-import java.util.ArrayList;
-import java.util.Collection;
+import org.apache.camel.util.ServiceHelper;
/**
- * Implements the Multicast pattern to send a message exchange to a number of endpoints, each endpoint receiving a copy of
- * the message exchange.
- *
+ * Implements the Multicast pattern to send a message exchange to a number of
+ * endpoints, each endpoint receiving a copy of the message exchange.
+ *
* @see Pipeline
* @version $Revision$
*/
public class MulticastProcessor extends ServiceSupport implements Processor {
private Collection<Processor> processors;
+ public MulticastProcessor(Collection<Processor> processors) {
+ this.processors = processors;
+ }
+
/**
* A helper method to convert a list of endpoints into a list of processors
*/
- public static <E extends Exchange> Collection<Processor> toProducers(Collection<Endpoint> endpoints) throws Exception {
+ public static <E extends Exchange> Collection<Processor> toProducers(Collection<Endpoint> endpoints)
+ throws Exception {
Collection<Processor> answer = new ArrayList<Processor>();
for (Endpoint endpoint : endpoints) {
answer.add(endpoint.createProducer());
@@ -48,10 +51,6 @@
return answer;
}
- public MulticastProcessor(Collection<Processor> processors) {
- this.processors = processors;
- }
-
@Override
public String toString() {
return "Multicast" + getProcessors();
@@ -72,7 +71,6 @@
ServiceHelper.startServices(processors);
}
-
/**
* Returns the producers to multicast to
*/
@@ -80,13 +78,14 @@
return processors;
}
-
/**
- * Strategy method to copy the exchange before sending to another endpoint. Derived classes such as the
- * {@link Pipeline} will not clone the exchange
- *
+ * Strategy method to copy the exchange before sending to another endpoint.
+ * Derived classes such as the {@link Pipeline} will not clone the exchange
+ *
* @param processor the processor that will send the exchange
- * @param exchange @return the current exchange if no copying is required such as for a pipeline otherwise a new copy of the exchange is returned.
+ * @param exchange
+ * @return the current exchange if no copying is required such as for a
+ * pipeline otherwise a new copy of the exchange is returned.
*/
protected Exchange copyExchangeStrategy(Processor processor, Exchange exchange) {
return exchange.copy();
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,41 +16,41 @@
*/
package org.apache.camel.processor;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-
import java.util.Collection;
import java.util.List;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
/**
- * Creates a Pipeline pattern where the output of the previous step is sent as input to the next step, reusing the same
- * message exchanges
- *
+ * Creates a Pipeline pattern where the output of the previous step is sent as
+ * input to the next step, reusing the same message exchanges
+ *
* @version $Revision$
*/
public class Pipeline extends MulticastProcessor implements Processor {
+
+
+ public Pipeline(Collection<Processor> processors) {
+ super(processors);
+ }
+
public static Processor newInstance(List<Processor> processors) {
if (processors.isEmpty()) {
return null;
- }
- else if (processors.size() == 1) {
+ } else if (processors.size() == 1) {
return processors.get(0);
}
return new Pipeline(processors);
}
- public Pipeline(Collection<Processor> processors) {
- super(processors);
- }
-
public void process(Exchange exchange) throws Exception {
Exchange nextExchange = exchange;
boolean first = true;
for (Processor producer : getProcessors()) {
if (first) {
first = false;
- }
- else {
+ } else {
nextExchange = createNextExchange(producer, nextExchange);
}
producer.process(nextExchange);
@@ -60,15 +59,16 @@
/**
* Strategy method to create the next exchange from the
- *
- * @param producer the producer used to send to the endpoint
+ *
+ * @param producer the producer used to send to the endpoint
* @param previousExchange the previous exchange
* @return a new exchange
*/
protected Exchange createNextExchange(Processor producer, Exchange previousExchange) {
Exchange answer = copyExchangeStrategy(previousExchange);
- // now lets set the input of the next exchange to the output of the previous message if it is not null
+ // now lets set the input of the next exchange to the output of the
+ // previous message if it is not null
Object output = previousExchange.getOut().getBody();
if (output != null) {
answer.getIn().setBody(output);
@@ -77,11 +77,12 @@
}
/**
- * Strategy method to copy the exchange before sending to another endpoint. Derived classes such as the
- * {@link Pipeline} will not clone the exchange
- *
+ * Strategy method to copy the exchange before sending to another endpoint.
+ * Derived classes such as the {@link Pipeline} will not clone the exchange
+ *
* @param exchange
- * @return the current exchange if no copying is required such as for a pipeline otherwise a new copy of the exchange is returned.
+ * @return the current exchange if no copying is required such as for a
+ * pipeline otherwise a new copy of the exchange is returned.
*/
protected Exchange copyExchangeStrategy(Exchange exchange) {
return exchange.copy();
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,6 +16,8 @@
*/
package org.apache.camel.processor;
+import java.util.Iterator;
+
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
@@ -24,15 +25,16 @@
import org.apache.camel.converter.ObjectConverter;
import org.apache.camel.impl.ServiceSupport;
import org.apache.camel.util.ExchangeHelper;
-import static org.apache.camel.util.ObjectHelper.notNull;
import org.apache.camel.util.ProducerCache;
-import java.util.Iterator;
+import static org.apache.camel.util.ObjectHelper.notNull;
/**
- * Implements a dynamic <a href="http://activemq.apache.org/camel/recipient-list.html">Recipient List</a> pattern
- * where the list of actual endpoints to send a message exchange to are dependent on some dynamic expression.
- *
+ * Implements a dynamic <a
+ * href="http://activemq.apache.org/camel/recipient-list.html">Recipient List</a>
+ * pattern where the list of actual endpoints to send a message exchange to are
+ * dependent on some dynamic expression.
+ *
* @version $Revision$
*/
public class RecipientList extends ServiceSupport implements Processor {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,9 +22,11 @@
// Code taken from the ActiveMQ codebase
/**
- * The policy used to decide how many times to redeliver and the time between the redeliveries before being sent to a
- * <a href="http://activemq.apache.org/camel/dead-letter-channel.html">Dead Letter Channel</a>
- *
+ * The policy used to decide how many times to redeliver and the time between
+ * the redeliveries before being sent to a <a
+ * href="http://activemq.apache.org/camel/dead-letter-channel.html">Dead Letter
+ * Channel</a>
+ *
* @version $Revision$
*/
public class RedeliveryPolicy implements Cloneable, Serializable {
@@ -33,10 +34,10 @@
protected int maximumRedeliveries = 6;
protected long initialRedeliveryDelay = 1000L;
protected double backOffMultiplier = 2;
- protected boolean useExponentialBackOff = false;
+ protected boolean useExponentialBackOff;
// +/-15% for a 30% spread -cgs
protected double collisionAvoidanceFactor = 0.15d;
- protected boolean useCollisionAvoidance = false;
+ protected boolean useCollisionAvoidance;
public RedeliveryPolicy() {
}
@@ -48,22 +49,22 @@
public RedeliveryPolicy copy() {
try {
- return (RedeliveryPolicy) clone();
- }
- catch (CloneNotSupportedException e) {
+ return (RedeliveryPolicy)clone();
+ } catch (CloneNotSupportedException e) {
throw new RuntimeException("Could not clone: " + e, e);
}
}
/**
- * Returns true if the policy decides that the message exchange should be redelivered
+ * Returns true if the policy decides that the message exchange should be
+ * redelivered
*/
public boolean shouldRedeliver(int redeliveryCounter) {
return redeliveryCounter < getMaximumRedeliveries();
}
// Builder methods
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
/**
* Sets the maximum number of times a message exchange will be redelivered
@@ -82,7 +83,8 @@
}
/**
- * Enables collision avoidence which adds some randomization to the backoff timings to reduce contention probability
+ * Enables collision avoidence which adds some randomization to the backoff
+ * timings to reduce contention probability
*/
public RedeliveryPolicy useCollisionAvoidance() {
setUseCollisionAvoidance(true);
@@ -90,7 +92,8 @@
}
/**
- * Enables exponential backof using the {@link #getBackOffMultiplier()} to increase the time between retries
+ * Enables exponential backof using the {@link #getBackOffMultiplier()} to
+ * increase the time between retries
*/
public RedeliveryPolicy useExponentialBackOff() {
setUseExponentialBackOff(true);
@@ -98,11 +101,12 @@
}
/**
- * Enables exponential backoff and sets the multiplier used to increase the delay between redeliveries
+ * Enables exponential backoff and sets the multiplier used to increase the
+ * delay between redeliveries
*/
- public RedeliveryPolicy backOffMultiplier(double backOffMultiplier) {
+ public RedeliveryPolicy backOffMultiplier(double multiplier) {
useExponentialBackOff();
- setBackOffMultiplier(backOffMultiplier);
+ setBackOffMultiplier(multiplier);
return this;
}
@@ -116,24 +120,26 @@
}
// Properties
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
public double getBackOffMultiplier() {
return backOffMultiplier;
}
/**
- * Sets the multiplier used to increase the delay between redeliveries if {@link #setUseExponentialBackOff(boolean)} is enabled
+ * Sets the multiplier used to increase the delay between redeliveries if
+ * {@link #setUseExponentialBackOff(boolean)} is enabled
*/
public void setBackOffMultiplier(double backOffMultiplier) {
this.backOffMultiplier = backOffMultiplier;
}
public short getCollisionAvoidancePercent() {
- return (short) Math.round(collisionAvoidanceFactor * 100);
+ return (short)Math.round(collisionAvoidanceFactor * 100);
}
/**
- * Sets the percentage used for collision avoidence if enabled via {@link #setUseCollisionAvoidance(boolean)}
+ * Sets the percentage used for collision avoidence if enabled via
+ * {@link #setUseCollisionAvoidance(boolean)}
*/
public void setCollisionAvoidancePercent(short collisionAvoidancePercent) {
this.collisionAvoidanceFactor = collisionAvoidancePercent * 0.01d;
@@ -144,7 +150,8 @@
}
/**
- * Sets the factor used for collision avoidence if enabled via {@link #setUseCollisionAvoidance(boolean)}
+ * Sets the factor used for collision avoidence if enabled via
+ * {@link #setUseCollisionAvoidance(boolean)}
*/
public void setCollisionAvoidanceFactor(double collisionAvoidanceFactor) {
this.collisionAvoidanceFactor = collisionAvoidanceFactor;
@@ -177,11 +184,9 @@
if (previousDelay == 0) {
redeliveryDelay = initialRedeliveryDelay;
- }
- else if (useExponentialBackOff && backOffMultiplier > 1) {
+ } else if (useExponentialBackOff && backOffMultiplier > 1) {
redeliveryDelay = Math.round(backOffMultiplier * previousDelay);
- }
- else {
+ } else {
redeliveryDelay = previousDelay;
}
@@ -192,7 +197,8 @@
* go in that direction. -cgs
*/
Random random = getRandomNumberGenerator();
- double variance = (random.nextBoolean() ? collisionAvoidanceFactor : -collisionAvoidanceFactor) * random.nextDouble();
+ double variance = (random.nextBoolean() ? collisionAvoidanceFactor : -collisionAvoidanceFactor)
+ * random.nextDouble();
redeliveryDelay += redeliveryDelay * variance;
}
@@ -204,7 +210,8 @@
}
/**
- * Enables/disables collision avoidence which adds some randomization to the backoff timings to reduce contention probability
+ * Enables/disables collision avoidence which adds some randomization to the
+ * backoff timings to reduce contention probability
*/
public void setUseCollisionAvoidance(boolean useCollisionAvoidance) {
this.useCollisionAvoidance = useCollisionAvoidance;
@@ -215,7 +222,8 @@
}
/**
- * Enables/disables exponential backof using the {@link #getBackOffMultiplier()} to increase the time between retries
+ * Enables/disables exponential backof using the
+ * {@link #getBackOffMultiplier()} to increase the time between retries
*/
public void setUseExponentialBackOff(boolean useExponentialBackOff) {
this.useExponentialBackOff = useExponentialBackOff;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Resequencer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Resequencer.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Resequencer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Resequencer.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,17 +16,17 @@
*/
package org.apache.camel.processor;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Processor;
import org.apache.camel.util.ExpressionComparator;
import org.apache.camel.util.ExpressionListComparator;
-
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
/**
* An implementation of the <a href="http://activemq.apache.org/camel/resequencer.html">Resequencer</a>
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -30,7 +29,7 @@
* @version $Revision$
*/
public class SendProcessor extends ServiceSupport implements Processor, Service {
- private static final transient Log log = LogFactory.getLog(SendProcessor.class);
+ private static final transient Log LOG = LogFactory.getLog(SendProcessor.class);
private Endpoint destination;
private Producer producer;
@@ -45,8 +44,7 @@
if (producer != null) {
try {
producer.stop();
- }
- finally {
+ } finally {
producer = null;
}
}
@@ -59,13 +57,11 @@
public void process(Exchange exchange) throws Exception {
if (producer == null) {
if (isStopped()) {
- log.warn("Ignoring exchange sent after processor is stopped: " + exchange);
- }
- else {
+ LOG.warn("Ignoring exchange sent after processor is stopped: " + exchange);
+ } else {
throw new IllegalStateException("No producer, this processor has not been started!");
}
- }
- else {
+ } else {
producer.process(exchange);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,20 +16,23 @@
*/
package org.apache.camel.processor;
+import java.util.Iterator;
+
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Processor;
import org.apache.camel.converter.ObjectConverter;
import org.apache.camel.impl.ServiceSupport;
-import static org.apache.camel.util.ObjectHelper.notNull;
import org.apache.camel.util.ServiceHelper;
-import java.util.Iterator;
+import static org.apache.camel.util.ObjectHelper.notNull;
/**
- * Implements a dynamic <a href="http://activemq.apache.org/camel/splitter.html">Splitter</a> pattern
- * where an expression is evaluated to iterate through each of the parts of a message and then each part is then send to some endpoint.
- *
+ * Implements a dynamic <a
+ * href="http://activemq.apache.org/camel/splitter.html">Splitter</a> pattern
+ * where an expression is evaluated to iterate through each of the parts of a
+ * message and then each part is then send to some endpoint.
+ *
* @version $Revision$
*/
public class Splitter extends ServiceSupport implements Processor {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Throttler.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Throttler.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Throttler.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Throttler.java Tue Aug 7 11:35:48 2007
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -21,14 +21,13 @@
/**
* A <a href="http://activemq.apache.org/camel/throttler.html">Throttler</a>
- * will set a limit on the maximum number of message exchanges which can be
- * sent to a processor within a specific time period.
- * <p/>
- * This pattern can be extremely useful if you have some external system which
- * meters access; such as only allowing 100 requests per second; or if huge load
- * can cause a particular systme to malfunction or to reduce its throughput
- * you might want to introduce some throttling.
- *
+ * will set a limit on the maximum number of message exchanges which can be sent
+ * to a processor within a specific time period. <p/> This pattern can be
+ * extremely useful if you have some external system which meters access; such
+ * as only allowing 100 requests per second; or if huge load can cause a
+ * particular systme to malfunction or to reduce its throughput you might want
+ * to introduce some throttling.
+ *
* @version $Revision: $
*/
public class Throttler extends DelayProcessorSupport {
@@ -37,7 +36,6 @@
private long startTimeMillis;
private long requestCount;
-
public Throttler(Processor processor, long maximumRequestsPerPeriod) {
this(processor, maximumRequestsPerPeriod, 1000);
}
@@ -50,11 +48,12 @@
@Override
public String toString() {
- return "Throttler[requests: " + maximumRequestsPerPeriod + " per: " + timePeriodMillis + " (ms) to: " + getProcessor() + "]";
+ return "Throttler[requests: " + maximumRequestsPerPeriod + " per: " + timePeriodMillis + " (ms) to: "
+ + getProcessor() + "]";
}
// Properties
- //-----------------------------------------------------------------------
+ // -----------------------------------------------------------------------
public long getMaximumRequestsPerPeriod() {
return maximumRequestsPerPeriod;
}
@@ -78,7 +77,8 @@
}
/**
- * The number of requests which have taken place so far within this time period
+ * The number of requests which have taken place so far within this time
+ * period
*/
public long getRequestCount() {
return requestCount;
@@ -92,7 +92,7 @@
}
// Implementation methods
- //-----------------------------------------------------------------------
+ // -----------------------------------------------------------------------
protected void delay(Exchange exchange) throws Exception {
long now = currentSystemTime();
if (startTimeMillis == 0) {
@@ -103,8 +103,7 @@
// so lets reset things
requestCount = 1;
startTimeMillis = now;
- }
- else {
+ } else {
if (++requestCount > maximumRequestsPerPeriod) {
// lets sleep until the start of the next time period
long time = startTimeMillis + timePeriodMillis;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java Tue Aug 7 11:35:48 2007
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -16,6 +16,8 @@
*/
package org.apache.camel.processor;
+import java.util.List;
+
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.impl.ServiceSupport;
@@ -23,15 +25,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.util.List;
-
/**
* Implements try/catch/finally type processing
- *
+ *
* @version $Revision: $
*/
public class TryProcessor extends ServiceSupport implements Processor {
- private static final Log log = LogFactory.getLog(TryProcessor.class);
+ private static final Log LOG = LogFactory.getLog(TryProcessor.class);
private final Processor tryProcessor;
private final List<CatchProcessor> catchClauses;
@@ -57,16 +57,14 @@
if (finallyProcessor != null) {
finallyProcessor.process(exchange);
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
handleException(exchange, e);
-
+
if (!doneTry && finallyProcessor != null) {
try {
finallyProcessor.process(exchange);
- }
- catch (Exception e2) {
- log.warn("Caught exception in finally block while handling other exception: " + e2, e2);
+ } catch (Exception e2) {
+ LOG.warn("Caught exception in finally block while handling other exception: " + e2, e2);
}
}
}
@@ -87,9 +85,8 @@
exchange.setException(e);
try {
catchClause.process(exchange);
- }
- catch (Exception e1) {
- log.warn("Caught exception inside catch clause: " + e1, e1);
+ } catch (Exception e1) {
+ LOG.warn("Caught exception inside catch clause: " + e1, e1);
throw e1;
}
return;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationCollection.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationCollection.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationCollection.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationCollection.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,19 +16,19 @@
*/
package org.apache.camel.processor.aggregate;
-import org.apache.camel.Exchange;
-import org.apache.camel.Expression;
-
import java.util.AbstractCollection;
-import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
+import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
+
/**
- * A {@link Collection} which aggregates exchanges together using a correlation expression
- * so that there is only a single message exchange sent for a single correlation key.
- *
+ * A {@link Collection} which aggregates exchanges together using a correlation
+ * expression so that there is only a single message exchange sent for a single
+ * correlation key.
+ *
* @version $Revision: 1.1 $
*/
public class AggregationCollection extends AbstractCollection<Exchange> {
@@ -37,7 +36,8 @@
private final AggregationStrategy aggregationStrategy;
private Map<Object, Exchange> map = new LinkedHashMap<Object, Exchange>();
- public AggregationCollection(Expression<Exchange> correlationExpression, AggregationStrategy aggregationStrategy) {
+ public AggregationCollection(Expression<Exchange> correlationExpression,
+ AggregationStrategy aggregationStrategy) {
this.correlationExpression = correlationExpression;
this.aggregationStrategy = aggregationStrategy;
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategy.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategy.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,10 +20,11 @@
/**
* A strategy for aggregating two exchanges together into a single exchange.
- * Possible implementations include performing some kind of combining or delta processing,
- * such as adding line items together into an invoice or just using the newest exchange and
- * removing old exchanges such as for state tracking or market data prices; where old values are of little use.
- *
+ * Possible implementations include performing some kind of combining or delta
+ * processing, such as adding line items together into an invoice or just using
+ * the newest exchange and removing old exchanges such as for state tracking or
+ * market data prices; where old values are of little use.
+ *
* @version $Revision: 1.1 $
*/
public interface AggregationStrategy {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/UseLatestAggregationStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/UseLatestAggregationStrategy.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/UseLatestAggregationStrategy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/UseLatestAggregationStrategy.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,18 +26,20 @@
import org.apache.commons.logging.LogFactory;
/**
- * An implementation of the
- * <a href="http://activemq.apache.org/camel/idempotent-consumer.html">Idempotent Consumer</a> pattern.
- *
+ * An implementation of the <a
+ * href="http://activemq.apache.org/camel/idempotent-consumer.html">Idempotent
+ * Consumer</a> pattern.
+ *
* @version $Revision: 1.1 $
*/
public class IdempotentConsumer extends ServiceSupport implements Processor {
- private static final transient Log log = LogFactory.getLog(IdempotentConsumer.class);
+ private static final transient Log LOG = LogFactory.getLog(IdempotentConsumer.class);
private Expression<Exchange> messageIdExpression;
private Processor nextProcessor;
private MessageIdRepository messageIdRepository;
- public IdempotentConsumer(Expression<Exchange> messageIdExpression, MessageIdRepository messageIdRepository, Processor nextProcessor) {
+ public IdempotentConsumer(Expression<Exchange> messageIdExpression,
+ MessageIdRepository messageIdRepository, Processor nextProcessor) {
this.messageIdExpression = messageIdExpression;
this.messageIdRepository = messageIdRepository;
this.nextProcessor = nextProcessor;
@@ -46,7 +47,8 @@
@Override
public String toString() {
- return "IdempotentConsumer[expression=" + messageIdExpression + ", repository=" + messageIdRepository + ", processor=" + nextProcessor + "]";
+ return "IdempotentConsumer[expression=" + messageIdExpression + ", repository=" + messageIdRepository
+ + ", processor=" + nextProcessor + "]";
}
public void process(Exchange exchange) throws Exception {
@@ -56,14 +58,13 @@
}
if (!messageIdRepository.contains(messageId)) {
nextProcessor.process(exchange);
- }
- else {
+ } else {
onDuplicateMessage(exchange, messageId);
}
}
// Properties
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
public Expression<Exchange> getMessageIdExpression() {
return messageIdExpression;
}
@@ -77,7 +78,7 @@
}
// Implementation methods
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
protected void doStart() throws Exception {
ServiceHelper.startServices(nextProcessor);
@@ -88,14 +89,15 @@
}
/**
- * A strategy method to allow derived classes to overload the behaviour of processing a duplicate message
- *
- * @param exchange the exchange
+ * A strategy method to allow derived classes to overload the behaviour of
+ * processing a duplicate message
+ *
+ * @param exchange the exchange
* @param messageId the message ID of this exchange
*/
protected void onDuplicateMessage(Exchange exchange, String messageId) {
- if (log.isDebugEnabled()) {
- log.debug("Ignoring duplicate message with id: " + messageId + " for exchange: " + exchange);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Ignoring duplicate message with id: " + messageId + " for exchange: " + exchange);
}
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/MemoryMessageIdRepository.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/MemoryMessageIdRepository.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/MemoryMessageIdRepository.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/MemoryMessageIdRepository.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,55 +16,58 @@
*/
package org.apache.camel.processor.idempotent;
-import org.apache.camel.util.LRUCache;
-
import java.util.HashMap;
import java.util.Map;
+import org.apache.camel.util.LRUCache;
+
/**
- * A memory based implementation of {@link MessageIdRepository}.
- * Care should be taken to use a suitable underlying {@link Map} to avoid this class being a memory leak
- *
+ * A memory based implementation of {@link MessageIdRepository}. Care should be
+ * taken to use a suitable underlying {@link Map} to avoid this class being a
+ * memory leak
+ *
* @version $Revision: 1.1 $
*/
public class MemoryMessageIdRepository implements MessageIdRepository {
private Map cache;
+ public MemoryMessageIdRepository(Map set) {
+ this.cache = set;
+ }
+
/**
- * Creates a new MemoryMessageIdRepository with a memory based respository. <b>Warning</b> this
- * method should only really be used for testing as it will involve keeping all message IDs in RAM.
+ * Creates a new MemoryMessageIdRepository with a memory based respository.
+ * <b>Warning</b> this method should only really be used for testing as it
+ * will involve keeping all message IDs in RAM.
*/
public static MessageIdRepository memoryMessageIdRepository() {
return memoryMessageIdRepository(new HashMap());
}
/**
- * Creates a new MemoryMessageIdRepository with a memory based respository. <b>Warning</b> this
- * method should only really be used for testing as it will involve keeping all message IDs in RAM.
+ * Creates a new MemoryMessageIdRepository with a memory based respository.
+ * <b>Warning</b> this method should only really be used for testing as it
+ * will involve keeping all message IDs in RAM.
*/
public static MessageIdRepository memoryMessageIdRepository(int cacheSize) {
return memoryMessageIdRepository(new LRUCache(cacheSize));
}
/**
- * Creates a new MemoryMessageIdRepository using the given {@link Map} to use to store the
- * processed Message ID objects. Warning be cafeful of the implementation of Map you use as
- * if you are not careful it could be a memory leak.
+ * Creates a new MemoryMessageIdRepository using the given {@link Map} to
+ * use to store the processed Message ID objects. Warning be cafeful of the
+ * implementation of Map you use as if you are not careful it could be a
+ * memory leak.
*/
public static MessageIdRepository memoryMessageIdRepository(Map cache) {
return new MemoryMessageIdRepository(cache);
}
- public MemoryMessageIdRepository(Map set) {
- this.cache = set;
- }
-
public boolean contains(String messageId) {
synchronized (cache) {
if (cache.containsKey(messageId)) {
return true;
- }
- else {
+ } else {
cache.put(messageId, messageId);
return false;
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/MessageIdRepository.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/MessageIdRepository.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/MessageIdRepository.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/MessageIdRepository.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/NoMessageIdException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/NoMessageIdException.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/NoMessageIdException.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/NoMessageIdException.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancer.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancer.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,9 +16,9 @@
*/
package org.apache.camel.processor.loadbalancer;
-import org.apache.camel.Processor;
-
import java.util.List;
+
+import org.apache.camel.Processor;
/**
* A strategy for load balancing across a number of {@link Processor} instances
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerSupport.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerSupport.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,10 +16,10 @@
*/
package org.apache.camel.processor.loadbalancer;
-import org.apache.camel.Processor;
-
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.camel.Processor;
/**
* A default base class for a {@link LoadBalancer} implementation
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/QueueLoadBalancer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/QueueLoadBalancer.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/QueueLoadBalancer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/QueueLoadBalancer.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,15 +16,15 @@
*/
package org.apache.camel.processor.loadbalancer;
+import java.util.List;
+
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import java.util.List;
-
/**
- * A base class for {@link LoadBalancer} implementations which choose a single destination for each exchange
- * (rather like JMS Queues)
- *
+ * A base class for {@link LoadBalancer} implementations which choose a single
+ * destination for each exchange (rather like JMS Queues)
+ *
* @version $Revision: 1.1 $
*/
public abstract class QueueLoadBalancer extends LoadBalancerSupport {
@@ -38,8 +37,7 @@
Processor processor = chooseProcessor(list, exchange);
if (processor == null) {
throw new IllegalStateException("No processors could be chosen to process " + exchange);
- }
- else {
+ } else {
processor.process(exchange);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/RandomLoadBalancer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/RandomLoadBalancer.java?view=diff&rev=563607&r1=563606&r2=563607
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/RandomLoadBalancer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/RandomLoadBalancer.java Tue Aug 7 11:35:48 2007
@@ -1,5 +1,4 @@
/**
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,10 +16,10 @@
*/
package org.apache.camel.processor.loadbalancer;
+import java.util.List;
+
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-
-import java.util.List;
/**
* Implements the random load balancing policy