Issue Details (XML | Word | Printable)

Key: TRANSACTION-12
Type: Wish Wish
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Holger Hoffstätte
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Commons Transaction

Use NIO for file copying/moving

Created: 02/Sep/06 04:08 PM   Updated: 18/Aug/07 09:42 PM
Return to search
Component/s: None
Affects Version/s: 1.2
Fix Version/s: 2.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File moveByRenameAndNIO.txt 2006-09-02 04:09 PM Holger Hoffstätte 1 kB
Issue Links:
Dependants
 

Resolution Date: 18/Aug/07 09:42 PM


 Description  « Hide
The Mule project (http://mule.codehaus.org/) is considering adoption of commons-transaction for (among other things) file transactions. Unfortunately inspection of the code reveals that FileHelper copies files in the slowest possible way (traditional Java I/O via Input/OutputStreams). Since some of our users move lots and/or large files (hundreds of megabytes to gigabytes) we implemented file moving by rename (atomic and obviously very fast when source and target are on the same filesystem) and NIO as backup strategy (a lot less CPU usage).
Attached is a code snippet that outlines the procedure; it would be cool if c-tx could adopt a similar strategy for moving via rename-first and copy via NIO. I do not know if and how this might conflict with c-tx's "transactional" behaviour and recovery but then again it is just a suggestion.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.