Announcement Announcement Module
No announcement yet.
Suggestions on design for multi-threaded reporting engine in Spring MVC Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suggestions on design for multi-threaded reporting engine in Spring MVC

    I'm looking for suggestions on the following design using Spring MVC:
    1. The client asynchronously kicks off a (possibly) long-running task and requests a UID to associate with it.
    2. Server generates UID to send back to the client, and passes the task off to a new thread
    3. Client actively polls the UID to see if the task is complete
    a. If complete, the server returns the results of this task to the polling client - in this case the results are downloaded as a PDF
    b. If not complete, the server updates a "keep-alive" timer for this thread
    4. Server kills any threads which have not had a keep-alive for xx minutes (i.e. the client polling was shut down)

    The point is to allow the user to explore other areas of the client website while their request is in progress, and once it is complete have it return their request to them. I have to do this asynchronously, as some of these tasks exceed the allowable idle time of TCP connections, a factor I have no control over.
    Primarily, 3a is the difficult part. How do I maintain a list of all threads such that I can peek in and check if they are complete, and if so use the return data (or an otherwise manipulated object within the thread) to launch a file download. I'm analyzing Callables, Executors and CompletionService, and I'm just not sure how it all fits together in a Spring environment. Or if there is something that might be better fitting within Spring?