svn commit: r1038033 - /camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java

2010-11-23 Thread davsclaus
Author: davsclaus
Date: Tue Nov 23 10:05:06 2010
New Revision: 1038033

URL: http://svn.apache.org/viewvc?rev=1038033view=rev
Log:
CAMEL-3348: Fixed theoretical condition that seda consumer may shutdown while 
an polled exchange was about to be processed.

Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java?rev=1038033r1=1038032r2=1038033view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
 Tue Nov 23 10:05:06 2010
@@ -50,6 +50,7 @@ public class SedaConsumer extends Servic
 // causing any exchanges to be lost due a tiny loophole between the 
exchange is polled
 // and when its registered as in flight exchange
 private final AtomicInteger tasks = new AtomicInteger();
+private volatile boolean pendingStop;
 private SedaEndpoint endpoint;
 private AsyncProcessor processor;
 private ExecutorService executor;
@@ -94,6 +95,9 @@ public class SedaConsumer extends Servic
 // number of pending messages on the queue
 int answer = endpoint.getQueue().size();
 if (answer == 0) {
+// signal we want to stop
+pendingStop = true;
+
 // if there are no pending exchanges we at first must ensure that
 // all tasks has been completed and the thread is stopped, to avoid
 // any condition which otherwise would cause an exchange to be lost
@@ -113,14 +117,22 @@ public class SedaConsumer extends Servic
 }
 
 public void run() {
+tasks.incrementAndGet();
+
 BlockingQueueExchange queue = endpoint.getQueue();
 while (queue != null  isRunAllowed()) {
+
+// we are done if there are no pending exchanges and we want to 
stop
+if (pendingStop  endpoint.getQueue().size() == 0) {
+// no more pending exchanges and we want to stop so break out
+break;
+}
+
 Exchange exchange = null;
 try {
 exchange = queue.poll(1000, TimeUnit.MILLISECONDS);
 if (exchange != null) {
 try {
-tasks.incrementAndGet();
 sendToConsumers(exchange);
 
 // log exception if an exception occurred and was not 
handled
@@ -129,8 +141,6 @@ public class SedaConsumer extends Servic
 }
 } catch (Exception e) {
 getExceptionHandler().handleException(Error 
processing exchange, exchange, e);
-} finally {
-tasks.decrementAndGet();
 }
 }
 } catch (InterruptedException e) {
@@ -147,6 +157,8 @@ public class SedaConsumer extends Servic
 }
 }
 
+tasks.decrementAndGet();
+
 if (LOG.isDebugEnabled()) {
 LOG.debug(Ending this polling consumer thread, there are still  
+ tasks.get() +  threads left.);
 }
@@ -193,6 +205,8 @@ public class SedaConsumer extends Servic
 }
 
 protected void doStart() throws Exception {
+// reset state
+pendingStop = false;
 tasks.set(0);
 
 int poolSize = endpoint.getConcurrentConsumers();




svn commit: r1038075 - /camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java

2010-11-23 Thread davsclaus
Author: davsclaus
Date: Tue Nov 23 11:59:23 2010
New Revision: 1038075

URL: http://svn.apache.org/viewvc?rev=1038075view=rev
Log:
CAMEL-3355: Fixed concurrenct modification exception potentially thrown on high 
load when performing onCompletion.

Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java?rev=1038075r1=1038074r2=1038075view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java
 Tue Nov 23 11:59:23 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.util;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
@@ -36,12 +37,16 @@ public final class UnitOfWorkHelper {
 boolean failed = exchange.isFailed();
 
 if (synchronizations != null  !synchronizations.isEmpty()) {
+// work on a copy of the list to avoid any modification which may 
cause ConcurrentModificationException
+ListSynchronization copy = new 
ArrayListSynchronization(synchronizations);
+
 // reverse so we invoke it FILO style instead of FIFO
-Collections.reverse(synchronizations);
+Collections.reverse(copy);
 // and honor if any was ordered by sorting it accordingly
-Collections.sort(synchronizations, new OrderedComparator());
+Collections.sort(copy, new OrderedComparator());
+
 // invoke synchronization callbacks
-for (Synchronization synchronization : synchronizations) {
+for (Synchronization synchronization : copy) {
 try {
 if (failed) {
 if (log.isTraceEnabled()) {




svn commit: r1038476 - in /camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy: ./ csv/ format/ kvp/

2010-11-23 Thread hadrian
Author: hadrian
Date: Wed Nov 24 04:53:00 2010
New Revision: 1038476

URL: http://svn.apache.org/viewvc?rev=1038476view=rev
Log:
CAMEL-3356. Improved locale support in camel-bindy

Added:

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
Modified:

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BytePatternFormat.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DatePatternFormat.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DoublePatternFormat.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/FloatPatternFormat.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerPatternFormat.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LongPatternFormat.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/NumberPatternFormat.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/ShortPatternFormat.java

camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java

Added: 
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java?rev=1038476view=auto
==
--- 
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
 (added)
+++ 
camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
 Wed Nov 24 04:53:00 2010
@@ -0,0 +1,68 @@
+/**
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.bindy;
+
+import java.util.Locale;
+
+import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.PackageScanClassResolver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public abstract class BindyAbstractDataFormat implements DataFormat {
+private String[] packages;
+private String locale;
+private BindyAbstractFactory modelFactory;
+
+public BindyAbstractDataFormat() {
+}
+
+public BindyAbstractDataFormat(String... packages) {
+this.packages = packages;
+}
+
+public String[] getPackages() {
+return packages;
+}
+
+public void setPackages(String... packages) {
+this.packages = packages;
+}
+
+public String getLocale() {
+return locale;
+}
+
+public void setLocale(String locale) {
+this.locale = locale;
+}
+
+public BindyAbstractFactory getFactory(PackageScanClassResolver resolver) 
throws Exception {
+if (modelFactory == null) {
+modelFactory = createModelFactory(resolver);
+modelFactory.setLocale(locale);
+}
+return modelFactory;
+}
+
+public void setModelFactory(BindyAbstractFactory modelFactory) {
+this.modelFactory = modelFactory;
+}
+
+protected abstract BindyAbstractFactory 

[CONF] Apache Camel Camel 2.6.0 Release

2010-11-23 Thread confluence







Camel 2.6.0 Release
Page edited by Hadrian Zbarcea


 Changes (1)
 



...
* [CXF] and [CXFRS] use the CXF continuation API when using CXF 2.3.x. * Fixed a rare situation in which an [Exchange] could be lost during graceful shutdown on the [SEDA] endpoints, usually more apparent on high volume systems. 
* Improved support for Locale in [Bindy] for Number and Date formats. 
 h3. New [Enterprise Integration Patterns] 
...

Full Content

Camel 2.6.0 release (currently in progress)




New and Noteworthy

Welcome to the 2.6.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...)


	Fixed issue in OSGi with refreshing Camel bundles causing a race condition when discovering type converters
	Introduced ScheduledRoutePolicy with the Quartz component
	Java DSL RouteBuilder now fails if onException and the likes are not configured before routes, which they must.
	Easier to debug routes from camel-test using the Debugger
	Fixed problem installing camel-cxf feature on Apache Karaf.
	The EIP now supports property placeholders in the String based options (a few spots in Java DSL where its not possible). For example: 

convertBodyTo type="String" charset="{{foo.myCharset}}"/

	Introduced ScheduledRoutePolicy to allow you to schedule when routes should be active.
	Introduced stepwise option to FTP component to allow end users to control how to traverse directories of the FTP servers. This allows you to set stepwise=false to return back to the behavior from Camel 2.0 - 2.4. See more at the FTP documentation.
	Thread names now outputs CamelContext name which makes it easier to differentiate when running multiple Camel applications in the same JVM.
	Introduced contentCache option to XSLT component to allow easy reloading of stylesheets during development.
	Improved Camel JMX to always find next free name when registering in JMX and existing name exists (to remedy name clash). This makes it easier when deploying muliple WARs in the same JVM where the Camel applications may have same CamelContext id. In OSGi the name in JMX now has the bundle id as prefix.
	Fixed BeanShell language
	Quartz now supports using older versions (eg versions 1.6/1.7) of quartz JARs.
	The Aggregator EIP will use a synchronous invocation when processing completed aggregated Exchanges, when not running in parallel mode. This ensures no internal task queue is used, which otherwise could stack up tasks and under certain conditions eat up memory. Enable parallelProcessing if you want to use a separate thread for processing completed aggregated Exchanges.
	LDAP supports paging.
	CXF and CXFRS use the CXF continuation API when using CXF 2.3.x.
	Fixed a rare situation in which an Exchange could be lost during graceful shutdown on the SEDA endpoints, usually more apparent on high volume systems.
	Improved support for Locale in Bindy for Number and Date formats.



New Enterprise Integration Patterns

New Components


	Spring Web Services
	JMX



New DSL

New Annotations

New Data Formats


	Syslog



New Languages

New Examples


	JMX Component Example



New Tutorials

API breaking


	camel-test JAR in the CamelSpringTestSupport classes now returns a more generic AbstractApplicationContext type in the createApplicationContext method.



Known Issues


	The Tracer may not output all details for some situations such as when using onCompletion or intercept etc.
	Not all Examples have ANT build.xml files to run the example using ANT.
	Project cannot be fully build using Maven 3.0
	One may encounter build errors in camel-ftp with java versions older than "1.5.0_24"
	Dozer does not work in OSGi
	camel-blueprint is not fully feature complete (such as @Producer, @Consume is not supported)
	camel-blueprint using package scan does not work



Important changes to consider when upgrading


	Upgraded to Spring 3.0.5
	Upgraded to Apache CXF 2.3.0 (although CXF 2.2.11 is still supported)
	Upgraded to Jetty 7.2.0.v20101020
	The Java DSL now enforces onException and the likes to be defined before routes, if not Camel will fail starting the route.
	The Aggregator EIP will use a synchronous invocation when processing completed aggregated Exchanges, when not running in parallel mode. This ensures no internal task queue is used, which otherwise could stack up tasks and under certain conditions eat up memory. Enable parallelProcessing if you want to use a separate thread for processing completed aggregated Exchanges.
	Camel now fails fast if staring a LifecycleStrategy fails on startup. For example if there is issue with JMX that will now cause Camel to not startup at all. If you have trouble with JMX before you can disable JMX on Camel and allow it to startup.




Getting the Distributions

Binary 

svn commit: r1038490 - /camel/trunk/parent/pom.xml

2010-11-23 Thread ningjiang
Author: ningjiang
Date: Wed Nov 24 06:05:43 2010
New Revision: 1038490

URL: http://svn.apache.org/viewvc?rev=1038490view=rev
Log:
CAMEL-3357 Upgrade SpringSecurity to 3.0.5.RELEASE

Modified:
camel/trunk/parent/pom.xml

Modified: camel/trunk/parent/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1038490r1=1038489r2=1038490view=diff
==
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Wed Nov 24 06:05:43 2010
@@ -129,7 +129,7 @@
 spring-javaconfig-version1.0.0-20090215/spring-javaconfig-version
 spring-version3.0.5.RELEASE/spring-version
 spring-osgi-version1.2.0/spring-osgi-version
-spring-security-version3.0.3.RELEASE/spring-security-version
+spring-security-version3.0.5.RELEASE/spring-security-version
 spring-ws-version1.5.9/spring-ws-version
 stax-api-version1.0.1/stax-api-version
 stringtemplate-version3.0/stringtemplate-version




svn commit: r1038502 - in /camel/trunk/components: ./ camel-cxf/src/main/java/org/apache/camel/component/cxf/ camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/ camel-cxf/src/test/java/org/

2010-11-23 Thread joed
Author: joed
Date: Wed Nov 24 06:49:35 2010
New Revision: 1038502

URL: http://svn.apache.org/viewvc?rev=1038502view=rev
Log:
Fixes the jaxrs endpoint not handling exceptions.
Exceptions are by default if the code returned is  207 handled.


Added:

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java
Modified:

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
camel/trunk/components/camel-osgi/pom.xml
camel/trunk/components/camel-spring/pom.xml
camel/trunk/components/pom.xml

Modified: 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java?rev=1038502r1=1038501r2=1038502view=diff
==
--- 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
 Wed Nov 24 06:49:35 2010
@@ -51,6 +51,7 @@ public interface CxfConstants {
 String CAMEL_CXF_RS_EXTRACT_ENTITY = CamelCxfRsExtractEntity;
 String CAMEL_CXF_RS_OPERATION_RESOURCE_INFO_STACK = 
CamelCxfRsOperationResourceInfoStack;
 String CAMEL_CXF_ATTACHMENTS = CamelAttachments;
+String CAMEL_CXF_RS_THROW_EXCEPTION_ON_FAILURE = 
CamelCxfRsThrowExceptionOnFailure;
 }
 
 

Added: 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java?rev=1038502view=auto
==
--- 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java
 (added)
+++ 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java
 Wed Nov 24 06:49:35 2010
@@ -0,0 +1,70 @@
+/**
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.cxf;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.camel.CamelException;
+
+public class CxfOperationException extends CamelException implements 
Serializable {
+
+private static final long serialVersionUID = 803109169584916327L;
+private final String uri;
+private final String redirectLocation;
+private final int statusCode;
+private final String statusText;
+private final MapString, String responseHeaders;
+private final String responseBody;
+
+public CxfOperationException(String uri, int statusCode, String 
statusText, String location, MapString, String responseHeaders,
+ String responseBody) {
+super(JAXRS operation failed invoking  + uri +  with statusCode:  
+ statusCode + (location != null ? , redirectLocation:  + location
+: ));
+this.uri = uri;
+this.statusCode = statusCode;
+this.statusText = statusText;
+this.redirectLocation = location;
+this.responseHeaders = responseHeaders;
+this.responseBody = responseBody;
+}
+
+public String getRedirectLocation() {
+return redirectLocation;
+}
+
+public String getResponseBody() {
+return responseBody;
+}
+
+public MapString, String getResponseHeaders() {
+return responseHeaders;
+}
+
+public int getStatusCode() {
+return statusCode;
+}
+
+public String getStatusText() {
+return statusText;
+}
+
+public String getUri() {
+return uri;
+}
+}
\ No newline at end of file

Modified: 

svn commit: r1038511 - /camel/trunk/components/pom.xml

2010-11-23 Thread davsclaus
Author: davsclaus
Date: Wed Nov 24 07:53:55 2010
New Revision: 1038511

URL: http://svn.apache.org/viewvc?rev=1038511view=rev
Log:
Reverse merging a commit by mistake.

Modified:
camel/trunk/components/pom.xml

Modified: camel/trunk/components/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=1038511r1=1038510r2=1038511view=diff
==
--- camel/trunk/components/pom.xml (original)
+++ camel/trunk/components/pom.xml Wed Nov 24 07:53:55 2010
@@ -80,9 +80,7 @@
 modulecamel-lucene/module
 modulecamel-mail/module
 modulecamel-mina/module
-   !--
 modulecamel-msv/module
-   --
 modulecamel-mvel/module
 modulecamel-netty/module
 modulecamel-nagios/module
@@ -130,9 +128,7 @@
 jdk1.6/jdk
   /activation
   modules
-   !--
 modulecamel-web/module
-   --
 modulecamel-web-standalone/module
   /modules
 /profile