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 8255495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:32:44+00:00 2026-06-08T01:32:44+00:00

I have a web service which generates a bunch of files on the server

  • 0

I have a web service which generates a bunch of files on the server (say tomcat), which get zipped up and streamed back to the client through the servlet’s OutputStream.

This part is clear. The part that I am struggling with is how to manage these files so that if two client happen to use this feature at the same time.

I can think of several possible solutions and I am not sure what is the simplest and best way to handle this and would love to hear some thoughts.

For example: I could create a directory with the time-stamp appended to the directory name e.g. tmp_123142345 and delete this folder after I’m done writing the zip file to the stream. It’s very unlikely that two people will try to download the same file in the same millisecond.

But, is there a better way?

  • 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-06-08T01:32:46+00:00Added an answer on June 8, 2026 at 1:32 am

    It’s unlikely, but not impossible. You will probably want a solution that you can boast in board meeting that it’s collision free. 🙂

    Have a global synchronized counter or better AtomicLong counter. Create the directory name like "tmp_"+ (atomicLongCounter.addAndGet(1))

    So each will have unique directory even if they landed at the same millisecond.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a RESTful web service which runs on Glassfish Application Server. When I
I have a web service in which I am manipulating POST and GET methods
Say I have a web project which uses a WCF service for behind-the-scenes processing,
1. I need to build a Web Service Server (Simulator) which generates the xml
I have a web service (JAX-RS/Spring) that generates SQL queries which run against a
I have some types which are generated by a web service reference. I want
I have web service which i want to use to upload image to the
I have web service which return json string like : d={main0ID:abc.es/main,main1ID:ah/main} I wanna append
I have web-service which give list of property at a particular area My problem
I am a little confused about Accept-Encoding . I have Web Service which would

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.