Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Scheduler Servlet not working properly

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
 
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Bear.
I will keep in mind from next time.
 
Bear Bibeault
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Next time? Why not fix it this time?
 
Durgesh Rajbhar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



reply
    Bookmark Topic Watch Topic
  • New Topic