Solved

Java file write in a transaction

Posted on 2013-01-28
2
295 Views
Last Modified: 2013-02-11
Hello team,

I have a Java application which which needs to write a file to a filesystem destination completely before being read by anything.  Wouldn't this be easily achieved by running the file writing logic inside a transaction?  

This should not allow any user or application to see the file until writing is 100% complete.  Am I correct in this idea?
0
Comment
Question by:Phil5780
2 Comments
 
LVL 4

Accepted Solution

by:
tvedtem earned 500 total points
ID: 38829549
What do you mean by 'transaction' ?  
That's usually a term I'd use when dealing with databases.

One way of working with files is to write to a temporary file, and when complete (and successful), rename/move the file.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38830442
I have a Java application which which needs to write a file to a filesystem destination completely before being read by anything.
What is 'being read'?

Don't describe the code you think you need or the steps. Describe the GOAL
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
more than one jdk and one jre 1 50
tomcat startup error 5 101
Running JavaFX on JDeveloper 12C 1 52
Fast way to search item into Java Array (Rhino compatible) 2 31
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues undeā€¦
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question