Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scheduler Servlet not working properly

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good morning All,

I needed a scheduler which could upload some xml files from remot server to my server location through FTP but
when I restart the server it upload the files from remote server to my server location but when I put xml files in between
(when server running) at remote server then it does not upload the files to my server.

Can any one tell me the reason/solution.


import java.util.Timer;
import java.util.TimerTask;

import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServlet;

import com.broadvision.action.xmlrequest.XMLRequestUtil;

import corp.broadvision.org.util.BVLog;

public class SchedularServlet extends HttpServlet {
public void init(ServletConfig conf) {

try {


int initialDelay = Integer.parseInt(conf.getInitParameter("initialDelay")); // start after 30 seconds 30000
int period = Integer.parseInt(conf.getInitParameter("period")); // repeat every 5 minutes 300000300000

Timer timer = new Timer();

TimerTask task = new TimerTask() {
public void run() {


boolean rssobj=new com.broadvision.action.xmlrequest.XMLRequestUtil().getXMLRequestFiles2DB();
if(!rssobj){
BVLog.error(20,"Either no file at RIL server location or getXMLRequestFiles2DB return false:"+rssobj);

}

}
};

timer.scheduleAtFixedRate(task, initialDelay, period);


}
catch (Exception e) {
BVLog.error(20,"Exception inside SchedularServlet class:::"+e.toString());
e.printStackTrace();
}
}
}

Thanks in advance.

Regards,
Durgesh Pratap Rajbhar
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information.

Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.
 
Durgesh Rajbhar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear.
I will keep in mind from next time.
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Next time? Why not fix it this time?
 
Durgesh Rajbhar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



 
And then the flying monkeys attacked. My only defense was this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic