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 2017/04/12 11:00:07 UTC
[1/5] camel git commit: CAMEL-11135: fixed model
Repository: camel
Updated Branches:
refs/heads/camel-2.17.x cfb25cde1 -> 54a67b00c
refs/heads/camel-2.18.x 6886c0bba -> bb68f9659
refs/heads/master 19fa67a64 -> 7d2fb2115
CAMEL-11135: fixed model
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7d2fb211
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7d2fb211
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7d2fb211
Branch: refs/heads/master
Commit: 7d2fb2115dff484ca6cbd44ff1df66777cd803da
Parents: ee14787
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 12:58:23 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 12:58:32 2017 +0200
----------------------------------------------------------------------
.../org/apache/camel/model/dataformat/ProtobufDataFormat.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/7d2fb211/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java
index 1d1146b1..cde7b29 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/ProtobufDataFormat.java
@@ -79,6 +79,10 @@ public class ProtobufDataFormat extends DataFormatDefinition {
this.contentTypeFormat = contentTypeFormat;
}
+ public String getContentTypeFormat() {
+ return contentTypeFormat;
+ }
+
public Object getDefaultInstance() {
return defaultInstance;
}
[2/5] camel git commit: CAMEL-11138: ConsumerTemplate - If cache is
full then polling consumer should be stopped to not leak resources
Posted by da...@apache.org.
CAMEL-11138: ConsumerTemplate - If cache is full then polling consumer should be stopped to not leak resources
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ee147873
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ee147873
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ee147873
Branch: refs/heads/master
Commit: ee147873016dcf719eaa1c405f2a095905d30bdc
Parents: 19fa67a
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 12:58:08 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 12:58:32 2017 +0200
----------------------------------------------------------------------
.../org/apache/camel/impl/ConsumerCache.java | 11 +++-
.../impl/ConsumerCacheZeroCapacityTest.java | 59 ++++++++++++++++++++
2 files changed, 68 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ee147873/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
index 2e6fdda..20deb90 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
@@ -134,9 +134,16 @@ public class ConsumerCache extends ServiceSupport {
if (pollingConsumer instanceof IsSingleton) {
singleton = ((IsSingleton) pollingConsumer).isSingleton();
}
- if (!singleton) {
+ String key = endpoint.getEndpointUri();
+ boolean cached = consumers.containsKey(key);
+ if (!singleton || !cached) {
try {
- // stop and shutdown non-singleton producers as we should not leak resources
+ // stop and shutdown non-singleton/non-cached consumers as we should not leak resources
+ if (!singleton) {
+ LOG.debug("Released PollingConsumer: {} is stopped as consumer is not singleton", endpoint);
+ } else {
+ LOG.debug("Released PollingConsumer: {} is stopped as consumer cache is full", endpoint);
+ }
ServiceHelper.stopAndShutdownService(pollingConsumer);
} catch (Exception ex) {
if (ex instanceof RuntimeCamelException) {
http://git-wip-us.apache.org/repos/asf/camel/blob/ee147873/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java b/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
new file mode 100644
index 0000000..3cbf2d4
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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
+ */
+public class ConsumerCacheZeroCapacityTest extends ContextTestSupport {
+
+ public void testConsumerCacheZeroCapacity() throws Exception {
+ ConsumerCache cache = new ConsumerCache(this, context, 0);
+ cache.start();
+
+ assertEquals("Size should be 0", 0, cache.size());
+
+ Endpoint endpoint = context.getEndpoint("file:target/foo?fileName=foo.txt");
+ PollingConsumer consumer = cache.acquirePollingConsumer(endpoint);
+ assertNotNull(consumer);
+ assertEquals("Started", ((org.apache.camel.support.ServiceSupport) consumer).getStatus().name());
+
+ // let it run a poll
+ consumer.receive(1000);
+
+ boolean found = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains("target/foo"));
+ assertTrue("Should find file consumer thread", found);
+
+ cache.releasePollingConsumer(endpoint, consumer);
+
+ // takes a little to stop
+ Thread.sleep(1000);
+
+ assertEquals("Stopped", ((org.apache.camel.support.ServiceSupport) consumer).getStatus().name());
+
+ // should not be a file consumer thread
+ found = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains("target/foo"));
+ assertFalse("Should not find file consumer thread", found);
+
+ cache.stop();
+ }
+
+}
\ No newline at end of file
[5/5] camel git commit: CAMEL-11138: Remove java 8 stuff as this is
java 7
Posted by da...@apache.org.
CAMEL-11138: Remove java 8 stuff as this is java 7
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/54a67b00
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/54a67b00
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/54a67b00
Branch: refs/heads/camel-2.17.x
Commit: 54a67b00ca700ed73c6c9fb7ab6410629818e999
Parents: 2e069c9
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 12:59:58 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 12:59:58 2017 +0200
----------------------------------------------------------------------
.../org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java | 7 -------
1 file changed, 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/54a67b00/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java b/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
index 3cbf2d4..49c5c83 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
@@ -39,9 +39,6 @@ public class ConsumerCacheZeroCapacityTest extends ContextTestSupport {
// let it run a poll
consumer.receive(1000);
- boolean found = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains("target/foo"));
- assertTrue("Should find file consumer thread", found);
-
cache.releasePollingConsumer(endpoint, consumer);
// takes a little to stop
@@ -49,10 +46,6 @@ public class ConsumerCacheZeroCapacityTest extends ContextTestSupport {
assertEquals("Stopped", ((org.apache.camel.support.ServiceSupport) consumer).getStatus().name());
- // should not be a file consumer thread
- found = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains("target/foo"));
- assertFalse("Should not find file consumer thread", found);
-
cache.stop();
}
[4/5] camel git commit: CAMEL-11138: ConsumerTemplate - If cache is
full then polling consumer should be stopped to not leak resources
Posted by da...@apache.org.
CAMEL-11138: ConsumerTemplate - If cache is full then polling consumer should be stopped to not leak resources
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2e069c99
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2e069c99
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2e069c99
Branch: refs/heads/camel-2.17.x
Commit: 2e069c9935d25f71b283d18a7c7d756a76da6b09
Parents: cfb25cd
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 12:58:08 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 12:59:17 2017 +0200
----------------------------------------------------------------------
.../org/apache/camel/impl/ConsumerCache.java | 11 +++-
.../impl/ConsumerCacheZeroCapacityTest.java | 59 ++++++++++++++++++++
2 files changed, 68 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2e069c99/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
index 399012c..52e227f 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
@@ -134,9 +134,16 @@ public class ConsumerCache extends ServiceSupport {
if (pollingConsumer instanceof IsSingleton) {
singleton = ((IsSingleton) pollingConsumer).isSingleton();
}
- if (!singleton) {
+ String key = endpoint.getEndpointUri();
+ boolean cached = consumers.containsKey(key);
+ if (!singleton || !cached) {
try {
- // stop and shutdown non-singleton producers as we should not leak resources
+ // stop and shutdown non-singleton/non-cached consumers as we should not leak resources
+ if (!singleton) {
+ LOG.debug("Released PollingConsumer: {} is stopped as consumer is not singleton", endpoint);
+ } else {
+ LOG.debug("Released PollingConsumer: {} is stopped as consumer cache is full", endpoint);
+ }
ServiceHelper.stopAndShutdownService(pollingConsumer);
} catch (Exception ex) {
if (ex instanceof RuntimeCamelException) {
http://git-wip-us.apache.org/repos/asf/camel/blob/2e069c99/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java b/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
new file mode 100644
index 0000000..3cbf2d4
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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
+ */
+public class ConsumerCacheZeroCapacityTest extends ContextTestSupport {
+
+ public void testConsumerCacheZeroCapacity() throws Exception {
+ ConsumerCache cache = new ConsumerCache(this, context, 0);
+ cache.start();
+
+ assertEquals("Size should be 0", 0, cache.size());
+
+ Endpoint endpoint = context.getEndpoint("file:target/foo?fileName=foo.txt");
+ PollingConsumer consumer = cache.acquirePollingConsumer(endpoint);
+ assertNotNull(consumer);
+ assertEquals("Started", ((org.apache.camel.support.ServiceSupport) consumer).getStatus().name());
+
+ // let it run a poll
+ consumer.receive(1000);
+
+ boolean found = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains("target/foo"));
+ assertTrue("Should find file consumer thread", found);
+
+ cache.releasePollingConsumer(endpoint, consumer);
+
+ // takes a little to stop
+ Thread.sleep(1000);
+
+ assertEquals("Stopped", ((org.apache.camel.support.ServiceSupport) consumer).getStatus().name());
+
+ // should not be a file consumer thread
+ found = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains("target/foo"));
+ assertFalse("Should not find file consumer thread", found);
+
+ cache.stop();
+ }
+
+}
\ No newline at end of file
[3/5] camel git commit: CAMEL-11138: ConsumerTemplate - If cache is
full then polling consumer should be stopped to not leak resources
Posted by da...@apache.org.
CAMEL-11138: ConsumerTemplate - If cache is full then polling consumer should be stopped to not leak resources
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bb68f965
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bb68f965
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bb68f965
Branch: refs/heads/camel-2.18.x
Commit: bb68f96597e82eacdfafc54ec8fe3fa849c6b191
Parents: 6886c0b
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 12:58:08 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 12:58:59 2017 +0200
----------------------------------------------------------------------
.../org/apache/camel/impl/ConsumerCache.java | 11 +++-
.../impl/ConsumerCacheZeroCapacityTest.java | 59 ++++++++++++++++++++
2 files changed, 68 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/bb68f965/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
index 2e6fdda..20deb90 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ConsumerCache.java
@@ -134,9 +134,16 @@ public class ConsumerCache extends ServiceSupport {
if (pollingConsumer instanceof IsSingleton) {
singleton = ((IsSingleton) pollingConsumer).isSingleton();
}
- if (!singleton) {
+ String key = endpoint.getEndpointUri();
+ boolean cached = consumers.containsKey(key);
+ if (!singleton || !cached) {
try {
- // stop and shutdown non-singleton producers as we should not leak resources
+ // stop and shutdown non-singleton/non-cached consumers as we should not leak resources
+ if (!singleton) {
+ LOG.debug("Released PollingConsumer: {} is stopped as consumer is not singleton", endpoint);
+ } else {
+ LOG.debug("Released PollingConsumer: {} is stopped as consumer cache is full", endpoint);
+ }
ServiceHelper.stopAndShutdownService(pollingConsumer);
} catch (Exception ex) {
if (ex instanceof RuntimeCamelException) {
http://git-wip-us.apache.org/repos/asf/camel/blob/bb68f965/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java b/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
new file mode 100644
index 0000000..3cbf2d4
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/impl/ConsumerCacheZeroCapacityTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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
+ */
+public class ConsumerCacheZeroCapacityTest extends ContextTestSupport {
+
+ public void testConsumerCacheZeroCapacity() throws Exception {
+ ConsumerCache cache = new ConsumerCache(this, context, 0);
+ cache.start();
+
+ assertEquals("Size should be 0", 0, cache.size());
+
+ Endpoint endpoint = context.getEndpoint("file:target/foo?fileName=foo.txt");
+ PollingConsumer consumer = cache.acquirePollingConsumer(endpoint);
+ assertNotNull(consumer);
+ assertEquals("Started", ((org.apache.camel.support.ServiceSupport) consumer).getStatus().name());
+
+ // let it run a poll
+ consumer.receive(1000);
+
+ boolean found = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains("target/foo"));
+ assertTrue("Should find file consumer thread", found);
+
+ cache.releasePollingConsumer(endpoint, consumer);
+
+ // takes a little to stop
+ Thread.sleep(1000);
+
+ assertEquals("Stopped", ((org.apache.camel.support.ServiceSupport) consumer).getStatus().name());
+
+ // should not be a file consumer thread
+ found = Thread.getAllStackTraces().keySet().stream().anyMatch(t -> t.getName().contains("target/foo"));
+ assertFalse("Should not find file consumer thread", found);
+
+ cache.stop();
+ }
+
+}
\ No newline at end of file