Java file write in a transaction

Posted on 2013-01-28
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?
Question by:Phil5780
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

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.
LVL 86

Expert Comment

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

726 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