You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/02/04 07:24:46 UTC
svn commit: r906376 - in /camel/branches/camel-1.x: ./
camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java
camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java
Author: davsclaus
Date: Thu Feb 4 06:24:46 2010
New Revision: 906376
URL: http://svn.apache.org/viewvc?rev=906376&view=rev
Log:
Merged revisions 906342 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r906342 | ningjiang | 2010-02-04 04:37:40 +0100 (Thu, 04 Feb 2010) | 1 line
CAMEL-2445 applied patch with thanks to Stan and Jeff
........
Added:
camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java
- copied, changed from r906342, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java
Modified:
camel/branches/camel-1.x/ (props changed)
camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java
Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 4 06:24:46 2010
@@ -1 +1 @@
-/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781314-781349,781775,781
923,781974,781993,782557,782594,782681,782886,782918-782923,783204,783248,783363,783639,783704,785564,785584,785599,787206,787581,787598,787605,787928,788393,789121,789703,790560,790936,791379,791476,791767,792038,792381,792398,792899,793359,793518,793547-793555,793862,793935,794237,794368,794550,794967,795790,798027,798052,798063,798489,798864,799252,800340,800785,800797,801084,801196,801960,802307,802478,803559,807476,810751,812937,814493,816105,817654,818063,818182-818354,818744,818747,819475,819956,820152,820168,821272,821290,822655,823013,823018,823031,823102,823177,823575,824218,824721,825760,825765,828288,828333,832647,833285,833289,833350,833370,833381,833419,835511,880655,880667,883713,884525,884750,885876,887196,895119,896772,898201,901634,902688,903638,903970,904365,904440,904442,905171,905241,905585,905883,906013,906068
+/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781314-781349,781775,781
923,781974,781993,782557,782594,782681,782886,782918-782923,783204,783248,783363,783639,783704,785564,785584,785599,787206,787581,787598,787605,787928,788393,789121,789703,790560,790936,791379,791476,791767,792038,792381,792398,792899,793359,793518,793547-793555,793862,793935,794237,794368,794550,794967,795790,798027,798052,798063,798489,798864,799252,800340,800785,800797,801084,801196,801960,802307,802478,803559,807476,810751,812937,814493,816105,817654,818063,818182-818354,818744,818747,819475,819956,820152,820168,821272,821290,822655,823013,823018,823031,823102,823177,823575,824218,824721,825760,825765,828288,828333,832647,833285,833289,833350,833370,833381,833419,835511,880655,880667,883713,884525,884750,885876,887196,895119,896772,898201,901634,902688,903638,903970,904365,904440,904442,905171,905241,905585,905883,906013,906068,906342
Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java?rev=906376&r1=906375&r2=906376&view=diff
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java (original)
+++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java Thu Feb 4 06:24:46 2010
@@ -236,8 +236,9 @@
try {
try {
sendExchanges();
- } catch (Exception e) {
- getExceptionHandler().handleException(e);
+ } catch (Throwable t) {
+ // a fail safe to handle all exceptions being thrown
+ getExceptionHandler().handleException(t);
}
} finally {
queueLock.lock();
@@ -288,7 +289,12 @@
while (iter.hasNext()) {
Exchange exchange = iter.next();
iter.remove();
- processExchange(exchange);
+ try {
+ processExchange(exchange);
+ } catch (Throwable t) {
+ // must catch throwable to avoid growing memory
+ getExceptionHandler().handleException(t);
+ }
}
}
}
Copied: camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java (from r906342, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java)
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java?p2=camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java&r1=906342&r2=906376&rev=906376&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java (original)
+++ camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorExceptionTest.java Thu Feb 4 06:24:46 2010
@@ -20,20 +20,14 @@
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
public class AggregatorExceptionTest extends ContextTestSupport {
public void testAggregateAndOnException() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:error");
-
- // can change this to 5 when BatchProcessor's exception handling works properly
- mock.expectedMessageCount(0);
-
for (int c = 0; c <= 10; c++) {
template.sendBodyAndHeader("seda:start", "Hi!", "id", 123);
}
- assertMockEndpointsSatisfied();
+ Thread.sleep(2000);
}
@Override
@@ -41,15 +35,11 @@
return new RouteBuilder() {
@Override
public void configure() throws Exception {
-
final String exceptionString = "This is an Error not an Exception";
- //errorHandler(deadLetterChannel("mock:error"));
- onException(Throwable.class).handled(true).to("mock:error");
-
from("seda:start")
- .aggregate(header("id"))
- .batchSize(2)
+ .aggregator(header("id"))
+ .batchSize(5)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
throw new java.lang.NoSuchMethodError(exceptionString);