public interface StreamCachingStrategy extends StaticService
Modifier and Type | Interface and Description |
---|---|
static interface |
StreamCachingStrategy.SpoolRule
Rule for determine if stream caching should be spooled to disk or kept in-memory.
|
static class |
StreamCachingStrategy.SpoolUsedHeapMemoryLimit
Used for selecting if the memory limit is committed or maximum heap memory setting.
|
static interface |
StreamCachingStrategy.Statistics
Utilization statistics of stream caching.
|
Modifier and Type | Method and Description |
---|---|
void |
addSpoolRule(StreamCachingStrategy.SpoolRule rule)
Adds the
StreamCachingStrategy.SpoolRule rule to be used. |
StreamCache |
cache(Exchange exchange)
Caches the body aas a
StreamCache . |
int |
getBufferSize() |
String |
getSpoolCipher() |
File |
getSpoolDirectory() |
long |
getSpoolThreshold() |
StreamCachingStrategy.SpoolUsedHeapMemoryLimit |
getSpoolUsedHeapMemoryLimit() |
int |
getSpoolUsedHeapMemoryThreshold() |
StreamCachingStrategy.Statistics |
getStatistics()
Gets the utilization statistics.
|
boolean |
isAnySpoolRules() |
boolean |
isEnabled() |
boolean |
isRemoveSpoolDirectoryWhenStopping() |
void |
setAnySpoolRules(boolean any)
Sets whether if just any of the
StreamCachingStrategy.SpoolRule rules returns
true then shouldSpoolCache(long) returns true. |
void |
setBufferSize(int bufferSize)
Sets the buffer size to use when allocating in-memory buffers used for in-memory stream caches.
|
void |
setEnabled(boolean enabled)
Sets whether the stream caching is enabled.
|
void |
setRemoveSpoolDirectoryWhenStopping(boolean remove)
Whether to remove the temporary directory when stopping.
|
void |
setSpoolCipher(String cipher)
Sets a cipher name to use when spooling to disk to write with encryption.
|
void |
setSpoolDirectory(File path)
Sets the spool (temporary) directory to use for overflow and spooling to disk.
|
void |
setSpoolDirectory(String path) |
void |
setSpoolThreshold(long threshold)
Threshold in bytes when overflow to disk is activated.
|
void |
setSpoolUsedHeapMemoryLimit(StreamCachingStrategy.SpoolUsedHeapMemoryLimit bounds)
Sets what the upper bounds should be when
setSpoolUsedHeapMemoryThreshold(int) is in use. |
void |
setSpoolUsedHeapMemoryThreshold(int percentage)
Sets a percentage (1-99) of used heap memory threshold to activate spooling to disk.
|
boolean |
shouldSpoolCache(long length)
Determines if the stream should be spooled or not.
|
void setEnabled(boolean enabled)
boolean isEnabled()
void setSpoolDirectory(File path)
File getSpoolDirectory()
void setSpoolDirectory(String path)
void setSpoolThreshold(long threshold)
StreamCache.DEFAULT_SPOOL_THRESHOLD
bytes (eg 128kb). Use
-1 to disable overflow to disk.long getSpoolThreshold()
void setSpoolUsedHeapMemoryThreshold(int percentage)
percentage
- percentage of used heap memory.int getSpoolUsedHeapMemoryThreshold()
void setSpoolUsedHeapMemoryLimit(StreamCachingStrategy.SpoolUsedHeapMemoryLimit bounds)
setSpoolUsedHeapMemoryThreshold(int)
is in use.bounds
- the boundsStreamCachingStrategy.SpoolUsedHeapMemoryLimit getSpoolUsedHeapMemoryLimit()
void setBufferSize(int bufferSize)
IOHelper.DEFAULT_BUFFER_SIZE
int getBufferSize()
void setSpoolCipher(String cipher)
String getSpoolCipher()
void setRemoveSpoolDirectoryWhenStopping(boolean remove)
boolean isRemoveSpoolDirectoryWhenStopping()
void setAnySpoolRules(boolean any)
StreamCachingStrategy.SpoolRule
rules returns
true then shouldSpoolCache(long)
returns true. If this option is false, then
all the StreamCachingStrategy.SpoolRule
must return true.
The default value is false which means that all the rules must return true.boolean isAnySpoolRules()
StreamCachingStrategy.Statistics getStatistics()
void addSpoolRule(StreamCachingStrategy.SpoolRule rule)
StreamCachingStrategy.SpoolRule
rule to be used.boolean shouldSpoolCache(long length)
length
- the length of the streamStreamCache cache(Exchange exchange)
StreamCache
.exchange
- the exchangeStreamCache
, or null if not possible or no need to cache
the bodyApache Camel