Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is servlet appropriate for reading a schedule file from a file system?

 
mike tran
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I was given a pretty routine task to read a xml file from a file system and update its content into the database.
I already had a jaxb program to read the object from xml file and update it to database. Since the xml file is put there on my machine at 8am each day, and I have to write
a schedule program to pick up the file. I have not work on schedule program before so I would like to seek your help. I am thinking about reusing my jaxb program. I wonder what is the best way to approach it? Could i write a scheduler program in eclipse , and how do I call that program at a certain time, let says 7:58 am in the morning?

Thanks again for all of your help,

Mike
 
Paul Clapham
Sheriff
Posts: 21298
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A servlet? To run a scheduled job at the same time every day? No.

Just set up a cron job or a Windows scheduler job, depending on what operating system your file resides on.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does not sound like a servlet is an appropriate technology for this. Servlets are used to respond to requests from a browser.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quartz Job Scheduler
-just google and see whether it can help you.
 
Andreas Taber
Greenhorn
Posts: 5
C++ Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was faced with the same issue that you're facing a while ago. There are really no allowable ways of scheduling a process using a servlet since you should not be creating threads on your own. Therefore, it's advisable to use a cron job or a Window's service. Since I was using Windows, I elected to employ a java based Window's service. What a mistake as it was extremely fidgety to say the least. Fortunately, I know C# rather well having taught it many times over the years so I created my Window's service using that language.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic