Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4074590
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:11:26+00:00 2026-05-20T17:11:26+00:00

I want to retrieve from subscription and store feeds to DB from subscription after

  • 0

I want to retrieve from subscription and store feeds to DB from subscription after every 6 hours. I want to have a timer thread in background to accomplish this task.

What’s the best way? A normal timer thread or Quartz API?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:11:26+00:00Added an answer on May 20, 2026 at 5:11 pm

    To start, I wouldn’t use JSP for this. There it is not for.

    When you’re on Java EE 5, use the container-provided jobscheduling APIs for this. Further detail depends on the container you’re using. JBoss AS 5 for example ships with Quartz out the box. Or when you’re using a framework on top of JSP/Servlet which offers jobscheduling APIs, like as Spring, then you should use it.

    If there are none (e.g. you’re using just Tomcat 6), or you want to be independent from the container and/or framework, create a ServletContextListener with a ScheduledExecutorService. Further detail can be found in this answer.

    Or when you’re already on a Java EE 6 container which supports EJB 3.1 (JBoss AS 6, GlassFish 3, but thus not Tomcat 7), easiest is to create a @Singleton EJB with @Schedule method.

    @Singleton
    public class UpdateSubscriptions {
    
        @Schedule(hour="*/6", minute="0", second="0", persistent=false)
        public void run() {
            // Do your job here.
        }
    
    }        
    

    That’s it. No further configuration is necessary.


    Update: as per the comments, you’re using Tomcat (6 or 7?). To start a thread during webapp’s startup which runs the task every 6 hours, use the example as provided in the beforelinked answer and make the following change in the scheduleAtFixedRate() method

    scheduler.scheduleAtFixedRate(new UpdateSubscriptions(), 0, 6, TimeUnit.HOURS);
    

    The class UpdateSubscriptions must implement Runnable and the actual job needs to be done in the run() method which you @Override, like as in the example in the linked answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a HTML table as follows. I want retrieve row values from this
i have a NSString instance ,i want to retrieve value from it and store
I have a long string I want to retrieve from a URL and store
I have a list of record Id's that I want to retrieve from Sql
I have DropDownList with CascadingDropDown extender. If I want to retrieve data from the
I want to retrieve all clientID from my MCC account. I'm using this code
I want to retrieve information from SAP to Ruby on Rails. I found this
I have an array of category ids and want to retrieve articles from my
I have an XML file and I want to retrieve data from it so
I want to retrieve info from more than 1 table. I have tried to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.