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 2009/06/30 09:16:21 UTC
svn commit: r789593 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/
camel-core/src/main/java/org/apache/camel/component/direct/
camel-core/src/main/java/org/apache/camel/impl/
camel-core/src/main/java/org/apache/camel/management/ camel-co...
Author: davsclaus
Date: Tue Jun 30 07:16:21 2009
New Revision: 789593
URL: http://svn.apache.org/viewvc?rev=789593&view=rev
Log:
CAMEL-1771: Using LRUCache for endpoint registry in CamelContext to avoid eating to much memory when using a lot of unique endpoints such as the http endpoints with lenient properties.
Added:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextEndpointCacheTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerCacheTest.java (with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerCacheTest.java (with props)
camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java (with props)
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
camel/trunk/camel-core/src/main/java/org/apache/camel/management/CamelNamingStrategy.java
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java Tue Jun 30 07:16:21 2009
@@ -33,11 +33,28 @@
/**
* Returns the string representation of the endpoint URI
+ *
+ * @return the endpoint URI
*/
String getEndpointUri();
/**
+ * Returns a string key of this endpoint.
+ * <p/>
+ * This key is used by {@link org.apache.camel.spi.LifecycleStrategy} when registering endpoint.
+ * This allows to register different instances of endpoints with the same key.
+ * <p/>
+ * For JMX mbeans this allows us to use the same JMX Mbean for all endpoints that are logical
+ * the same but have different parameters. For instance the http endpoint.
+ *
+ * @return the endpoint key
+ */
+ String getEndpointKey();
+
+ /**
* Create a new exchange for communicating with this endpoint
+ *
+ * @return a new exchange
*/
Exchange createExchange();
@@ -47,6 +64,7 @@
* to be an {@link ExchangePattern#InOnly} or {@link ExchangePattern#InOut} exchange
*
* @param pattern the message exchange pattern for the exchange
+ * @return a new exchange
*/
Exchange createExchange(ExchangePattern pattern);
@@ -54,7 +72,8 @@
* Creates a new exchange for communicating with this exchange using the
* given exchange to pre-populate the values of the headers and messages
*
- * @param exchange given exchange to use for pre-polulate
+ * @param exchange given exchange to use for pre-populate
+ * @return a new exchange
*/
Exchange createExchange(Exchange exchange);
@@ -128,6 +147,8 @@
* dynamic URI options appended that is targeted for an external system.
* <p/>
* Most endpoints is configured to be <b>not</b> lenient.
+ *
+ * @return whether properties is lenient or not
*/
boolean isLenientProperties();
}
Added: camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java?rev=789593&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java (added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java Tue Jun 30 07:16:21 2009
@@ -0,0 +1,53 @@
+/**
+ * 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.direct;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.DefaultConsumer;
+
+/**
+ * The direct consumer.
+ *
+ * @version $Revision$
+ */
+public class DirectConsumer extends DefaultConsumer {
+
+ private DirectEndpoint endpoint;
+
+ public DirectConsumer(Endpoint endpoint, Processor processor) {
+ super(endpoint, processor);
+ this.endpoint = (DirectEndpoint) endpoint;
+ }
+
+ @Override
+ public void start() throws Exception {
+ if (!endpoint.isAllowMultipleConsumers() && !endpoint.getConsumers().isEmpty()) {
+ throw new IllegalStateException("Endpoint " + endpoint.getEndpointUri() + " only allows 1 active consumer but you attempted to start a 2nd consumer.");
+ }
+
+ endpoint.getConsumers().add(this);
+ super.start();
+ }
+
+ @Override
+ public void stop() throws Exception {
+ super.stop();
+ endpoint.getConsumers().remove(this);
+ }
+
+}
Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java Tue Jun 30 07:16:21 2009
@@ -51,23 +51,7 @@
}
public Consumer createConsumer(Processor processor) throws Exception {
- return new DefaultConsumer(this, processor) {
- @Override
- public void start() throws Exception {
- if (!allowMultipleConsumers && !consumers.isEmpty()) {
- throw new IllegalStateException("Endpoint " + getEndpointUri() + " only allows 1 active consumer but you attempted to start a 2nd consumer.");
- }
-
- consumers.add(this);
- super.start();
- }
-
- @Override
- public void stop() throws Exception {
- super.stop();
- consumers.remove(this);
- }
- };
+ return new DirectConsumer(this, processor);
}
public boolean isAllowMultipleConsumers() {
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java Tue Jun 30 07:16:21 2009
@@ -69,7 +69,7 @@
consumers.put(key, answer);
} else {
if (LOG.isDebugEnabled()) {
- LOG.debug("Consumer for endpoint: " + key + " is not singleton and thus not added to producer cache");
+ LOG.debug("Consumer for endpoint: " + key + " is not singleton and thus not added to consumer cache");
}
}
}
@@ -111,4 +111,13 @@
protected void doStart() throws Exception {
}
+ /**
+ * Returns the current size of the consumer cache
+ *
+ * @return the current size
+ */
+ int size() {
+ return consumers.size();
+ }
+
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Tue Jun 30 07:16:21 2009
@@ -70,6 +70,7 @@
import org.apache.camel.spi.RouteContext;
import org.apache.camel.spi.ServicePool;
import org.apache.camel.spi.TypeConverterRegistry;
+import org.apache.camel.util.LRUCache;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.ReflectionInjector;
import org.apache.camel.util.SystemHelper;
@@ -90,7 +91,7 @@
private static int nameSuffix;
private boolean routeDefinitionInitiated;
private String name;
- private final Map<String, Endpoint> endpoints = new HashMap<String, Endpoint>();
+ private final Map<String, Endpoint> endpoints = new LRUCache<String, Endpoint>(1000);
private final List<EndpointStrategy> endpointStrategies = new ArrayList<EndpointStrategy>();
private final Map<String, Component> components = new HashMap<String, Component>();
private List<Route> routes;
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java Tue Jun 30 07:16:21 2009
@@ -92,6 +92,21 @@
return endpointUri;
}
+ public String getEndpointKey() {
+ if (isLenientProperties()) {
+ // only use the endpoint uri without parameters as the properties is lenient
+ String uri = getEndpointUri();
+ if (uri.indexOf("?") != -1) {
+ return ObjectHelper.before(uri, "?");
+ } else {
+ return uri;
+ }
+ } else {
+ // use the full endpoint uri
+ return getEndpointUri();
+ }
+ }
+
public CamelContext getCamelContext() {
return camelContext;
}
@@ -225,4 +240,6 @@
return false;
}
+
+
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java Tue Jun 30 07:16:21 2009
@@ -67,6 +67,10 @@
return delegate.getEndpointUri();
}
+ public String getEndpointKey() {
+ return delegate.getEndpointKey();
+ }
+
public Exchange createExchange() {
return delegate.createExchange();
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java Tue Jun 30 07:16:21 2009
@@ -217,4 +217,14 @@
protected void doStart() throws Exception {
ServiceHelper.startServices(pool);
}
+
+ /**
+ * Returns the current size of the producer cache
+ *
+ * @return the current size
+ */
+ int size() {
+ return producers.size();
+ }
+
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/CamelNamingStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/CamelNamingStrategy.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/CamelNamingStrategy.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/CamelNamingStrategy.java Tue Jun 30 07:16:21 2009
@@ -48,7 +48,7 @@
public static final String TYPE_ROUTE = "routes";
protected String domainName;
- protected String hostName = "locahost";
+ protected String hostName = "localhost";
public CamelNamingStrategy() {
this("org.apache.camel");
@@ -111,7 +111,7 @@
} else {
return null;
}
-
+
StringBuffer buffer = new StringBuffer();
buffer.append(domainName).append(":");
buffer.append(KEY_CONTEXT + "=").append(getContextId(context)).append(",");
@@ -192,11 +192,16 @@
}
protected String getEndpointId(Endpoint ep) {
- String uri = ep.getEndpointUri();
- int pos = uri.indexOf('?');
- String id = (pos == -1) ? uri : uri.substring(0, pos);
- id += "?id=0x" + Integer.toHexString(ep.hashCode());
- return id;
+ if (ep.isSingleton()) {
+ return ep.getEndpointKey();
+ } else {
+ // non singleton then add hashcoded id
+ String uri = ep.getEndpointKey();
+ int pos = uri.indexOf('?');
+ String id = (pos == -1) ? uri : uri.substring(0, pos);
+ id += "?id=0x" + Integer.toHexString(ep.hashCode());
+ return id;
+ }
}
/**
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java Tue Jun 30 07:16:21 2009
@@ -92,7 +92,6 @@
public MulticastProcessor(Collection<Processor> processors, AggregationStrategy aggregationStrategy, boolean parallelProcessing, ExecutorService executorService, boolean streaming) {
notNull(processors, "processors");
- // TODO: end() does not work correctly with Splitter
this.processors = processors;
this.aggregationStrategy = aggregationStrategy;
this.isParallelProcessing = parallelProcessing;
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextEndpointCacheTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextEndpointCacheTest.java?rev=789593&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextEndpointCacheTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextEndpointCacheTest.java Tue Jun 30 07:16:21 2009
@@ -0,0 +1,60 @@
+/**
+ * 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.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+
+/**
+ * @version $Revision$
+ */
+public class DefaultCamelContextEndpointCacheTest extends ContextTestSupport {
+
+ public void testCacheEndpoints() throws Exception {
+ // test that we cache at most 1000 endpoints in camel context to avoid it eating to much memory
+ for (int i = 0; i < 1003; i++) {
+ String uri = "myendpoint?id=" + i;
+ Endpoint e = new DefaultEndpoint(uri, context) {
+ public Producer createProducer() throws Exception {
+ return null;
+ }
+ public Consumer createConsumer(Processor processor) throws Exception {
+ return null;
+ }
+ public boolean isSingleton() {
+ return true;
+ }
+ };
+
+ context.addEndpoint(uri, e);
+ }
+
+ Collection<Endpoint> col = context.getEndpoints();
+ assertEquals("Size should be 1000", 1000, col.size());
+ List<Endpoint> list = new ArrayList<Endpoint>(col);
+ assertEquals("myendpoint?id=3", list.get(0).getEndpointUri());
+ assertEquals("myendpoint?id=1002", list.get(999).getEndpointUri());
+ }
+
+}
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextEndpointCacheTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextEndpointCacheTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerCacheTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerCacheTest.java?rev=789593&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerCacheTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerCacheTest.java Tue Jun 30 07:16:21 2009
@@ -0,0 +1,44 @@
+/**
+ * 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.impl;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.PollingConsumer;
+
+/**
+ * @version $Revision$
+ */
+public class DefaultConsumerCacheTest extends ContextTestSupport {
+
+ public void testCacheConsumers() throws Exception {
+ ConsumerCache cache = new ConsumerCache();
+ cache.start();
+
+ assertEquals("Size should be 0", 0, cache.size());
+
+ // test that we cache at most 1000 producers to avoid it eating to much memory
+ for (int i = 0; i < 1003; i++) {
+ Endpoint e = context.getEndpoint("direct:queue:" + i);
+ PollingConsumer p = cache.getConsumer(e);
+ }
+
+ assertEquals("Size should be 1000", 1000, cache.size());
+ cache.stop();
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerCacheTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerCacheTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerCacheTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerCacheTest.java?rev=789593&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerCacheTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerCacheTest.java Tue Jun 30 07:16:21 2009
@@ -0,0 +1,44 @@
+/**
+ * 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.impl;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Producer;
+
+/**
+ * @version $Revision$
+ */
+public class DefaultProducerCacheTest extends ContextTestSupport {
+
+ public void testCacheProducers() throws Exception {
+ ProducerCache cache = new ProducerCache(context.getProducerServicePool());
+ cache.start();
+
+ assertEquals("Size should be 0", 0, cache.size());
+
+ // test that we cache at most 1000 producers to avoid it eating to much memory
+ for (int i = 0; i < 1003; i++) {
+ Endpoint e = context.getEndpoint("direct:queue:" + i);
+ Producer p = cache.getProducer(e);
+ }
+
+ assertEquals("Size should be 1000", 1000, cache.size());
+ cache.stop();
+ }
+
+}
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerCacheTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerCacheTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java?rev=789593&r1=789592&r2=789593&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapEndpoint.java Tue Jun 30 07:16:21 2009
@@ -70,6 +70,10 @@
return endpoint.getEndpointUri();
}
+ public String getEndpointKey() {
+ return endpoint.getEndpointUri();
+ }
+
public Exchange createExchange() {
return endpoint.createExchange();
}
@@ -168,6 +172,7 @@
headerFilterStrategy = strategy;
}
+
public boolean isLenientProperties() {
return false;
}
Added: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java?rev=789593&view=auto
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java (added)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java Tue Jun 30 07:16:21 2009
@@ -0,0 +1,81 @@
+/**
+ * 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.jetty;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
+
+/**
+ * @version $Revision$
+ */
+public class HttpProducerJMXBeansIssueTest extends CamelTestSupport {
+
+ private static final Log LOG = LogFactory.getLog(HttpProducerJMXBeansIssueTest.class);
+
+ @Override
+ public void setUp() throws Exception {
+ // to enable the JMX connector
+ enableJMX();
+ System.setProperty("org.apache.camel.jmx.createRmiConnector", "True");
+ super.setUp();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("jetty:http://localhost:9080/leak").transform(constant("Bye World"));
+
+ from("direct:leak").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ LOG.debug("URL is: " + exchange.getIn().getHeader("url"));
+ }
+ }).recipientList(header("url"));
+ }
+ };
+ }
+
+ @Test
+ public void testNothing() {
+ // do nothing as this test is manual
+ }
+
+ // @Test
+ // TODO: disabled as this is a manual test
+ public void testSendAlot() throws Exception {
+ Endpoint ep = context.getEndpoint("direct:leak");
+ Producer p = ep.createProducer();
+ p.start();
+
+ for (int i = 0; i < 10000; i++) {
+ Exchange ex = ep.createExchange();
+ ex.getIn().setHeader("url", "http://localhost:9080/leak?id=" + i);
+ p.process(ex);
+ }
+
+ p.stop();
+ }
+
+}
Propchange: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date