CAMEL-6476: Introducing StreamCachingStrategy SPI to make it easier to configure and allow 3rd party to plugin custom strategies. Work in progress.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/94133b95 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/94133b95 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/94133b95 Branch: refs/heads/master Commit: 94133b952907b85faad2a6f3bab79a04be8ebc2a Parents: 0f254e8 Author: Claus Ibsen <[email protected]> Authored: Sat Jul 20 13:13:55 2013 +0200 Committer: Claus Ibsen <[email protected]> Committed: Sat Jul 20 13:18:51 2013 +0200 ---------------------------------------------------------------------- .../main/java/org/apache/camel/StreamCache.java | 6 +++ .../ManagedStreamCachingStrategyMBean.java | 7 +++- .../stream/ByteArrayInputStreamCache.java | 5 ++- .../stream/CachedByteArrayOutputStream.java | 40 ++++++++++++++++++++ .../converter/stream/CachedOutputStream.java | 31 +++++++++------ .../converter/stream/FileInputStreamCache.java | 4 ++ .../converter/stream/InputStreamCache.java | 9 +++++ .../camel/converter/stream/ReaderCache.java | 4 ++ .../camel/converter/stream/SourceCache.java | 3 ++ .../converter/stream/StreamCacheConverter.java | 4 +- .../converter/stream/StreamSourceCache.java | 13 ++++++- .../impl/DefaultStreamCachingStrategy.java | 22 +++++++---- .../mbean/ManagedStreamCachingStrategy.java | 8 +++- .../apache/camel/spi/StreamCachingStrategy.java | 11 ++++-- .../ManagedStreamCachingStrategyTest.java | 5 ++- .../apache/camel/util/MessageHelperTest.java | 4 ++ .../camel/karaf/commands/ContextInfo.java | 4 ++ 17 files changed, 151 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/StreamCache.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/StreamCache.java b/camel-core/src/main/java/org/apache/camel/StreamCache.java index 26ef5be..089614a 100644 --- a/camel-core/src/main/java/org/apache/camel/StreamCache.java +++ b/camel-core/src/main/java/org/apache/camel/StreamCache.java @@ -45,4 +45,10 @@ public interface StreamCache { */ void writeTo(OutputStream os) throws IOException; + /** + * Whether this {@link StreamCache} is in memory only or + * spooled to persistent storage such as files. + */ + boolean inMemory(); + } http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedStreamCachingStrategyMBean.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedStreamCachingStrategyMBean.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedStreamCachingStrategyMBean.java index d9887b2..70acf3f 100644 --- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedStreamCachingStrategyMBean.java +++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedStreamCachingStrategyMBean.java @@ -47,7 +47,10 @@ public interface ManagedStreamCachingStrategyMBean { @ManagedAttribute(description = "Whether to remove spool directory when stopping") boolean isRemoveSpoolDirectoryWhenStopping(); - @ManagedAttribute(description = "Number of StreamCache created") - long getCacheCounter(); + @ManagedAttribute(description = "Number of in-memory StreamCache created") + long getCacheMemoryCounter(); + + @ManagedAttribute(description = "Number of spooled (not in-memory) StreamCache created") + long getCacheSpoolCounter(); } http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java b/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java index 120fc99..ba41c27 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java @@ -42,8 +42,11 @@ public class ByteArrayInputStreamCache extends FilterInputStream implements Stre } - @Override public void writeTo(OutputStream os) throws IOException { IOHelper.copyAndCloseInput(in, os); } + + public boolean inMemory() { + return true; + } } http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/converter/stream/CachedByteArrayOutputStream.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/CachedByteArrayOutputStream.java b/camel-core/src/main/java/org/apache/camel/converter/stream/CachedByteArrayOutputStream.java new file mode 100644 index 0000000..f22df74 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/CachedByteArrayOutputStream.java @@ -0,0 +1,40 @@ +/** + * 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.converter.stream; + +import java.io.ByteArrayOutputStream; + +/** + * A {@link ByteArrayOutputStream} that is capable of returning a + * {@link InputStreamCache} view of the buffer. + * <p/> + * This implementation avoids any buffer copying when caching in memory {@link java.io.InputStream} + * as the buffer can be shared. + */ +public final class CachedByteArrayOutputStream extends ByteArrayOutputStream { + + public CachedByteArrayOutputStream(int size) { + super(size); + } + + /** + * Creates a new {@link InputStreamCache} view of the byte array + */ + public InputStreamCache newInputStreamCache() { + return new InputStreamCache(buf, count); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java b/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java index b25046b..817e9e5 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java @@ -17,7 +17,6 @@ package org.apache.camel.converter.stream; import java.io.BufferedOutputStream; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; @@ -26,7 +25,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.GeneralSecurityException; - import javax.crypto.CipherOutputStream; import org.apache.camel.Exchange; @@ -40,7 +38,7 @@ import org.slf4j.LoggerFactory; /** * This output stream will store the content into a File if the stream context size is exceed the - * THRESHOLD which's default value is {@link StreamCache#DEFAULT_SPOOL_THRESHOLD} bytes . + * THRESHOLD value. The default THRESHOLD value is {@link StreamCache#DEFAULT_SPOOL_THRESHOLD} bytes . * <p/> * The temp file will store in the temp directory, you can configure it by setting the TEMP_DIR property. * If you don't set the TEMP_DIR property, it will choose the directory which is set by the @@ -75,7 +73,7 @@ public class CachedOutputStream extends OutputStream { public CachedOutputStream(Exchange exchange, boolean closedOnCompletion) { this.strategy = exchange.getContext().getStreamCachingStrategy(); - currentStream = new ByteArrayOutputStream(strategy.getBufferSize()); + currentStream = new CachedByteArrayOutputStream(strategy.getBufferSize()); if (closedOnCompletion) { // add on completion so we can cleanup after the exchange is done such as deleting temporary files @@ -153,10 +151,10 @@ public class CachedOutputStream extends OutputStream { flush(); if (inMemory) { - if (currentStream instanceof ByteArrayOutputStream) { - return new ByteArrayInputStream(((ByteArrayOutputStream) currentStream).toByteArray()); + if (currentStream instanceof CachedByteArrayOutputStream) { + return ((CachedByteArrayOutputStream) currentStream).newInputStreamCache(); } else { - throw new IllegalStateException("CurrentStream should be an instance of ByteArrayOutputStream but is: " + currentStream.getClass().getName()); + throw new IllegalStateException("CurrentStream should be an instance of CachedByteArrayOutputStream but is: " + currentStream.getClass().getName()); } } else { try { @@ -171,18 +169,29 @@ public class CachedOutputStream extends OutputStream { } public InputStream getWrappedInputStream() throws IOException { - // The WrappedInputStream will close the CachedOuputStream when it is closed + // The WrappedInputStream will close the CachedOutputStream when it is closed return new WrappedInputStream(this, getInputStream()); } + /** + * @deprecated use {@link #newStreamCache()} + */ + @Deprecated public StreamCache getStreamCache() throws IOException { + return newStreamCache(); + } + + /** + * Creates a new {@link StreamCache} from the data cached in this {@link OutputStream}. + */ + public StreamCache newStreamCache() throws IOException { flush(); if (inMemory) { - if (currentStream instanceof ByteArrayOutputStream) { - return new InputStreamCache(((ByteArrayOutputStream) currentStream).toByteArray()); + if (currentStream instanceof CachedByteArrayOutputStream) { + return ((CachedByteArrayOutputStream) currentStream).newInputStreamCache(); } else { - throw new IllegalStateException("CurrentStream should be an instance of ByteArrayOutputStream but is: " + currentStream.getClass().getName()); + throw new IllegalStateException("CurrentStream should be an instance of CachedByteArrayOutputStream but is: " + currentStream.getClass().getName()); } } else { try { http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java b/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java index 10f8b22..4494117 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java @@ -91,6 +91,10 @@ public final class FileInputStreamCache extends InputStream implements StreamCac } } + public boolean inMemory() { + return false; + } + @Override public int available() throws IOException { return getInputStream().available(); http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/converter/stream/InputStreamCache.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/InputStreamCache.java b/camel-core/src/main/java/org/apache/camel/converter/stream/InputStreamCache.java index 340675b..d808215 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/stream/InputStreamCache.java +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/InputStreamCache.java @@ -31,8 +31,17 @@ public final class InputStreamCache extends ByteArrayInputStream implements Stre super(data); } + public InputStreamCache(byte[] data, int count) { + super(data); + super.count = count; + } + public void writeTo(OutputStream os) throws IOException { os.write(buf, pos, count - pos); } + public boolean inMemory() { + return true; + } + } http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/converter/stream/ReaderCache.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/ReaderCache.java b/camel-core/src/main/java/org/apache/camel/converter/stream/ReaderCache.java index 381f08f..c4da171 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/stream/ReaderCache.java +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/ReaderCache.java @@ -54,6 +54,10 @@ public class ReaderCache extends StringReader implements StreamCache { os.write(data.getBytes()); } + public boolean inMemory() { + return true; + } + String getData() { return data; } http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/converter/stream/SourceCache.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/SourceCache.java b/camel-core/src/main/java/org/apache/camel/converter/stream/SourceCache.java index 9e23f51..9b2bf01 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/stream/SourceCache.java +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/SourceCache.java @@ -42,4 +42,7 @@ public final class SourceCache extends StringSource implements StreamCache { IOHelper.copy(getInputStream(), os); } + public boolean inMemory() { + return true; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/converter/stream/StreamCacheConverter.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/StreamCacheConverter.java b/camel-core/src/main/java/org/apache/camel/converter/stream/StreamCacheConverter.java index b138768..19fa2af 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/stream/StreamCacheConverter.java +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/StreamCacheConverter.java @@ -76,9 +76,11 @@ public final class StreamCacheConverter { @Converter public static StreamCache convertToStreamCache(InputStream stream, Exchange exchange) throws IOException { + // transfer the input stream to a cached output stream, and then creates a new stream cache view + // of the data, which ensures the input stream is cached and re-readable. CachedOutputStream cos = new CachedOutputStream(exchange); IOHelper.copyAndCloseInput(stream, cos); - return cos.getStreamCache(); + return cos.newStreamCache(); } @Converter http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java b/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java index 11bafc2..a50b8bc 100644 --- a/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java +++ b/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java @@ -41,7 +41,7 @@ public final class StreamSourceCache extends StreamSource implements StreamCache // set up CachedOutputStream with the properties CachedOutputStream cos = new CachedOutputStream(exchange); IOHelper.copyAndCloseInput(source.getInputStream(), cos); - streamCache = cos.getStreamCache(); + streamCache = cos.newStreamCache(); readCache = null; setSystemId(source.getSystemId()); stream = (InputStream) streamCache; @@ -82,6 +82,17 @@ public final class StreamSourceCache extends StreamSource implements StreamCache } } + public boolean inMemory() { + if (streamCache != null) { + return streamCache.inMemory(); + } else if (readCache != null) { + return readCache.inMemory(); + } else { + // should not happen + return true; + } + } + @Override public InputStream getInputStream() { return stream; http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/impl/DefaultStreamCachingStrategy.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultStreamCachingStrategy.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultStreamCachingStrategy.java index 0fcbf07..d9879c9 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultStreamCachingStrategy.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultStreamCachingStrategy.java @@ -35,8 +35,6 @@ import org.slf4j.LoggerFactory; */ public class DefaultStreamCachingStrategy extends org.apache.camel.support.ServiceSupport implements CamelContextAware, StreamCachingStrategy { - // TODO: add JMX counters for in memory vs spooled - // TODO: Add support for mark // TODO: logic for spool to disk in this class so we can control this // TODO: add memory based watermarks for spool to disk @@ -59,7 +57,8 @@ public class DefaultStreamCachingStrategy extends org.apache.camel.support.Servi private String spoolChiper; private int bufferSize = IOHelper.DEFAULT_BUFFER_SIZE; private boolean removeSpoolDirectoryWhenStopping = true; - private volatile long cacheCounter; + private volatile long cacheMemoryCounter; + private volatile long cacheSpoolCounter; public CamelContext getCamelContext() { return camelContext; @@ -121,14 +120,22 @@ public class DefaultStreamCachingStrategy extends org.apache.camel.support.Servi this.removeSpoolDirectoryWhenStopping = removeSpoolDirectoryWhenStopping; } - public long getCacheCounter() { - return cacheCounter; + public long getCacheMemoryCounter() { + return cacheMemoryCounter; + } + + public long getCacheSpoolCounter() { + return cacheSpoolCounter; } public StreamCache cache(Exchange exchange) { StreamCache cache = exchange.getIn().getBody(StreamCache.class); if (cache != null) { - cacheCounter++; + if (cache.inMemory()) { + cacheMemoryCounter++; + } else { + cacheSpoolCounter++; + } } return cache; } @@ -233,7 +240,8 @@ public class DefaultStreamCachingStrategy extends org.apache.camel.support.Servi FileUtil.removeDir(spoolDirectory); } - cacheCounter = 0; + cacheMemoryCounter = 0; + cacheSpoolCounter = 0; } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedStreamCachingStrategy.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedStreamCachingStrategy.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedStreamCachingStrategy.java index f20ee87..b9b193f 100644 --- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedStreamCachingStrategy.java +++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedStreamCachingStrategy.java @@ -82,7 +82,11 @@ public class ManagedStreamCachingStrategy extends ManagedService implements Mana return streamCachingStrategy.isRemoveSpoolDirectoryWhenStopping(); } - public long getCacheCounter() { - return streamCachingStrategy.getCacheCounter(); + public long getCacheMemoryCounter() { + return streamCachingStrategy.getCacheMemoryCounter(); + } + + public long getCacheSpoolCounter() { + return streamCachingStrategy.getCacheSpoolCounter(); } } http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/main/java/org/apache/camel/spi/StreamCachingStrategy.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/spi/StreamCachingStrategy.java b/camel-core/src/main/java/org/apache/camel/spi/StreamCachingStrategy.java index d7d6f39..2d4721d 100644 --- a/camel-core/src/main/java/org/apache/camel/spi/StreamCachingStrategy.java +++ b/camel-core/src/main/java/org/apache/camel/spi/StreamCachingStrategy.java @@ -59,7 +59,7 @@ public interface StreamCachingStrategy extends Service { long getSpoolThreshold(); /** - * Sets the buffer size to use when copying between buffers. + * Sets the buffer size to use when allocating in-memory buffers used for in-memory stream caches. * <p/> * The default size is {@link org.apache.camel.util.IOHelper#DEFAULT_BUFFER_SIZE} */ @@ -86,9 +86,14 @@ public interface StreamCachingStrategy extends Service { boolean isRemoveSpoolDirectoryWhenStopping(); /** - * Gets the counter for number of {@link StreamCache} created. + * Gets the counter for number of in-memory {@link StreamCache} created. */ - long getCacheCounter(); + long getCacheMemoryCounter(); + + /** + * Gets the counter for number of spooled (not in-memory) {@link StreamCache} created. + */ + long getCacheSpoolCounter(); /** * Caches the body aas a {@link StreamCache}. http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/test/java/org/apache/camel/management/ManagedStreamCachingStrategyTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedStreamCachingStrategyTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedStreamCachingStrategyTest.java index e91d7dc..c4f45f3 100644 --- a/camel-core/src/test/java/org/apache/camel/management/ManagedStreamCachingStrategyTest.java +++ b/camel-core/src/test/java/org/apache/camel/management/ManagedStreamCachingStrategyTest.java @@ -58,7 +58,10 @@ public class ManagedStreamCachingStrategyTest extends ManagementTestSupport { Integer size = (Integer) mbeanServer.getAttribute(name, "BufferSize"); assertEquals(IOHelper.DEFAULT_BUFFER_SIZE, size.intValue()); - Long counter = (Long) mbeanServer.getAttribute(name, "CacheCounter"); + Long counter = (Long) mbeanServer.getAttribute(name, "CacheMemoryCounter"); + assertEquals(0, counter.longValue()); + + counter = (Long) mbeanServer.getAttribute(name, "CacheSpoolCounter"); assertEquals(0, counter.longValue()); String chiper = (String) mbeanServer.getAttribute(name, "SpoolChiper"); http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java index 2091cfe..0f83c6b 100644 --- a/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java +++ b/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java @@ -62,6 +62,10 @@ public class MessageHelperTest extends TestCase { public void writeTo(OutputStream os) throws IOException { // noop } + + public boolean inMemory() { + return true; + } }); MessageHelper.resetStreamCache(message); assertTrue("Should have reset the stream cache", reset.get()); http://git-wip-us.apache.org/repos/asf/camel/blob/94133b95/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java ---------------------------------------------------------------------- diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java index 1098a82..0566617 100644 --- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java +++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java @@ -152,6 +152,10 @@ public class ContextInfo extends OsgiCommandSupport { camelContext.getStreamCachingStrategy().getSpoolChiper(), camelContext.getStreamCachingStrategy().getBufferSize(), camelContext.getStreamCachingStrategy().isRemoveSpoolDirectoryWhenStopping()))); + + System.out.println(StringEscapeUtils.unescapeJava(String.format("\t [cacheMemoryCounter=%s, cacheSpoolCounter=%s]", + camelContext.getStreamCachingStrategy().getCacheMemoryCounter(), + camelContext.getStreamCachingStrategy().getCacheSpoolCounter()))); } long activeRoutes = 0;
