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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:49:18+00:00 2026-06-08T19:49:18+00:00

I am developing a REST web service that should receive files from the clients

  • 0

I am developing a REST web service that should receive files from the clients and precess them. After that I receive the file I want to create a new thread for processing the file, so I am not obliged to wait the end of the processing function.

If I am receiving a lot of files, I will create a lot of thread. Is there any limit or danger to do this?

  • 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-08T19:49:21+00:00Added an answer on June 8, 2026 at 7:49 pm

    If I am receiving a lot of files, I will create a lot of thread. Is there any limit or danger to do this?

    Yes there is. I’m not sure there is a limit on the number of threads but at some point you will run out of memory. Each of the threads have stack and other local storage that will add up.

    I’d limit the number of threads that you have forked by not accepting new connections if the limit has been reached. Then additional connections will wait in the TCP queues until the previous requests have been completed.

    A better mechanism may be to use a fixed ExecutorService thread pool instead of forking a new thread for each request:

    // create a thread pool with 10 workers
    ExecutorService threadPool = Executors.newFixedThreadPool(10);
    while(!shutdown) {
       // receive a request from your service -- this is tricky
       // process it using the thread pool
       threadPool.submit(new MyRequest(...));
    }
    ...
    // once we have submitted all jobs to the thread pool, it should be shutdown
    threadPool.shutdown();
    

    The tricky part of this is how to determine which connections are readable. That takes NIO code, channel selectors, etc. to multiplex the connections you have to see which ones can be read.

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

Sidebar

Related Questions

I'm currently developing a WCF REST Web Service that will be running on Microsoft
I'm developing a REST web service in which I use a ID in the
I am developing a Rest Web service in salesforce.com platform. I wrote it and
I'm developing a REST-ful web service using RESTEasy deployed on Tomcat. I've configured an
I'm developing a Rest service. Some external system sends me an XML file which
I have written a REST web service with Jersey Server (that totally rocks !).
We're in the process of developing a WCF REST web service which just receives
I am developing an app for android mobiles that communicates with a json/rest web
I am developing a JSON/REST web API, for which I specifically want third party
I am developing a RESTful WCF service which I then want to consume from

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.