Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6162669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:41:34+00:00 2026-05-23T21:41:34+00:00

I have many applications writing to my file in concurrent in java.I want to

  • 0

I have many applications writing to my file in concurrent in java.I want to make this operation concurrent and also want my file to preserve order.I have
Thread 1 writing from website 1

Thread 2 writing from website 2

Thread 3 writing from website 3

And i want to preserve order.

How can i do this
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:41:36+00:00Added an answer on May 23, 2026 at 9:41 pm

    You can use regular synchronization mechanism. Create file repository that contains references to java.io.File objects. It will expose API like getFile(String path). Every time you want to access file do the following:

    File file = FileRepository.getFile("foo.txt");
    synchronized(file) {
      // perform any manipulations. 
    }
    

    Other way to synchronize access to files is:

    FileChannel.lock()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have many Spring web applications to make on a WebLogic server and are
I have always wondered about this. So many application setups have a zip file
I'm writing an application that will have to be able to handle many concurrent
Say, for example, I have many web applications using the same class library compiled
Many applications have grids that display data from a database table one page at
Many applications have dialogs which have totally custom-looking dialogs, big fat tool-bars and non-rectangular
I have a few C# .dll projects which are common to many applications. Currently,
Introduction In my current organisation, we have many desktop and web applications all feeding
I have a database that many different client applications (a smattering of web services,
In my web application we have many users.I want to set permission for each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.