[ 
https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52960#action_52960
 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

*Some observations*

1. 
CachedOutputStream is build as if its holds multiple streams (i.e. it has a 
streamList) but its only used in Camel as wrapping a single stream.

2.
It got an output locked option that is newer used, i.e. could be removed to 
reduce complexity

3.
it lacks try .. finally to ensure proper house cleaning when working with 
streams

4.
It silently ignore the output dir if provided with one and it cannot create the 
directory.
It should really throw an exception to indicate the temp output folder cannot 
be used

5. Some methods is newer used and should be removed to reduce complexity
- resetOut
- lockOutputStream
- getBytes
- writeCacheTo (can be removed as its only used for toString that should just 
omit printing the stream content)
- getOut
- getTempFile
- getInputStream

6. Duplicate code
The write methods has duplicate code that should be avoided and instead invoke 
a single method that does the actual writing

7. Using java.io.File instead of NIO
The NIO library have features to support paging memory to disk. But yeah its a 
bit complex to work with the NIO but it is faster and it can leverage the OS 
memory paging to be faster. 



> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the 
> same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages 
> over 64k to disk. In some cases the *tmp message files are not being cleaned 
> up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to