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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:57:25+00:00 2026-05-12T16:57:25+00:00

A little help please. I am designing a stateless server that will have the

  • 0

A little help please.

I am designing a stateless server that will have the following functionality:

  1. Client submits a job to the server.
  2. Client is blocked while the server tries to perform the job.
  3. The server will spawn one or multiple threads to perform the job.
  4. The job either finishes, times out or fails.
  5. The appropriate response (based on the outcome) is created, the client is unblocked and the response is handed off to the client.

Here is what I have thought of so far.

  1. Client submits a job to the server.
  2. The server assigns an ID to the job, places the job on a Queue and then places the Client on an another queue (where it will be blocked).
  3. Have a thread pool that will execute the job, fetch the result and appropriately create the response.
  4. Based on ID, pick the client out of the queue (thereby unblocking it), give it the response and send it off.

Steps 1,3,4 seems quite straight forward however any ideas about how to put the client in a queue and then block it. Also, any pointers that would help me design this puppy would be appreciated.

Cheers

  • 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-12T16:57:25+00:00Added an answer on May 12, 2026 at 4:57 pm

    Why do you need to block the client? Seems like it would be easier to return (almost) immediately (after performing initial validation, if any) and give client a unique ID for a given job. Client would then be able to either poll using said ID or, perhaps, provide a callback.

    Blocking means you’re holding on to a socket which obviously limits the upper number of clients you can serve simultaneously. If that’s not a concern for your scenario and you absolutely need to block (perhaps you have no control over client code and can’t make them poll?), there’s little sense in spawning threads to perform the job unless you can actually separate it into parallel tasks. The only “queue” in that case would be the one held by common thread pool. The workflow would basically be:

    1. Create a thread pool (such as ThreadPoolExecutor)
    2. For each client request:
      1. If you have any parts of the job that you can execute in parallel, delegate them to the pool.
      2. And / or do them in the current thread.
      3. Wait until pooled job parts complete (if applicable).
      4. Return results to client.
    3. Shutdown the thread pool.

    No IDs are needed per se; though you may need to use some sort of latch for 2.1 / 2.3 above.

    Timeouts may be a tad tricky. If you need them to be more or less precise you’ll have to keep your main thread (the one that received client request) free from work and have it signal submitted job parts (by flipping a flag) when timeout is reached and return immediately. You’ll have to check said flag periodically and terminate your execution once it’s flipped; pool will then reclaim the thread.

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

Sidebar

Related Questions

I have a little dilemma that maybe you can help me sort out. I've
Little help for a javascript noob please... I have this in a .js file
I am getting a little confused and need some help please. Take these two
Please help! I'm really at my wits' end. My program is a little personal
I need a little help on this subject. I have a Web application written
I need a little help in defining the following Windows GDI type in C#.
A little regex help please. Why are these different? Regex.Replace((999) 555-0000 /x ext123, /x.*|[^0-9],
Little help here please . I am trying to create this lisp macro which
I'm going crazy with this my little app... Please help me!!! this is the
I have a little Problem, i have implemented the following method to open an

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.