• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Can a servlet perform an action at intervals

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am designing a domino application which will be taking data and writing it to an Oracle database.
In one of the design meetings, we decided to look at using a servlet to do the connection to the domino database and, if there were new documents to post, send the data to the Oracle database via JDBC.
Is it possible to have a servlet running which would check a domino database every say, 5 min or 20 min and, if necessary, write data to Oracle?
If so, can you point me in a direction as to how I should approach coding this? My other option would be to use a scheduled domino agent to connect using ODBC, but I was thinking that the servlet would be less resource intensive since it's always loaded.
Since it's domino, I'm restricted to 1.18 JVM.
Thanks in advance.
Steve
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What first comes to my mind is to do your procedure in a thread, and call Thread.sleep() with the appropriate interval.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what I have heard, spawning threads in a Servlet is never a good idea.
My advice would be to create a stand alone program on the Server (or somewhere) that performs your operation. Do not do it in a servlet.
Is there any particular reason you wanted to use a servlet?
You may get better responses in the Servlet forum if a Bartender would be so kind as to move this.
 
Steve Cannon
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to both of you for your reply.
I had thought about a stand alone program and that may be the way to go. I'm still learning Java so I didn't know all the options to consider. Also, my reason for posting in this forum was that it seemed like a pretty beginner type of question.
One thing I was thinking about was submitting to the servlet. If I did a post to the servlet, it could connect to the Oracle database and write the data as well. This way, I wouldn't have to be worrying about having the servlet or program constantly checking the database. There might be some other issues to contend with if I do that though.
Would doing a post to a servlet be a better idea or do you think a stand alone Java program would work better?
Thanks in advance for your reply.
Steve
 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic