Solved

Java file write in a transaction

Posted on 2013-01-28
2
288 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now