This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

use of servlet for this app

 
H Wilson
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am in the analysis phase of a project with the following specs (in a nutshell):

Allow users to save their searches for the journals in our database and receive via email periodic reports (they may choose a frequency of daily, weekly, monthly) listing new journals added to our database matching their search.

It seems obvious that I want to create a table containing fields for the actual search (query text), the user id, email address to send the report to, the frequency of the report, the date report was last run, and the date the report expires. (Those are the essential fields. I may discover additional fields as I delve further into this project.)

The application will run a nightly cron job to generate the reports. In my idea for its implementation, it would iterate over the search table described above, creating and emailing each report. Actually, I will probably query the search table for reports that are due to run that night and iterate over that result set.

My question here is about the use of a servlet for this job. Couldn't I create one object to iterate through the "reports due" result set and submit the process of creating and emailing the reports to a servlet? I'm thinking that such an implementation would allow for a multi-threaded solution. Obviously, iterating over a result set is sequential, but if I call a servlet to do the actual processing, don't I have multi-threading in that the app could call the servlet again before finishing each request? The iterating object would not have to wait for the servlet to finish generating one report before going to the next record in the result set and calling the servlet again, right?

Is there a better way to handle this process?

Sorry for the lengthy post and thanks in advance.
 
Jeffrey Spaulding
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm,

you would need a client that fires a series of requests to your servlet with appropriate parameters.

As i understand it, you mainly are interested in the multithreaded nature of a servlet.

If this is really the only thing that makes you think of a servlet you might consider to use a simple multithreaded application that does the same without having the overhead of the servlet container.

J.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic