Results 1 to 4 of 4
  1. #1
    gurleen is offline Member
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    Default issue while using scheduleAtFixedRate()...

    Hi,
    I have written a code where in i need a counter to reset to zero after every 24 hrs. I have written below code but it is not working. although if i provide the value of period for 30 mins, it is working fine.

    Please help:

    private static Timer timer = new Timer();
    private static int delay = 5000; // delay for 5 sec.
    private static int period = 86400000; // repeat every day.
    timer.scheduleAtFixedRate(new TimerTask() {
    public void run() {
    count =0;
    log.info("Reseted value of count is ===========> "+count );
    }
    }, delay, period);


    Thanks.

  2. #2
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    5

    Default Re: issue while using scheduleAtFixedRate()...

    ^I think this link could be helpful, particularly example 2:

    Learner To Beginner: Java Timer Examples

    Please, put you code inside [code] tags.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: issue while using scheduleAtFixedRate()...

    Forum Rules
    Guide For New Members
    BB Code List - Java Programming Forum

    Not in any way an advanced question. Moving to New to Java.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    gurleen is offline Member
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    Default Re: issue while using scheduleAtFixedRate()...

    Thanks for the help. I am able to get the logs now.

Similar Threads

  1. RMI issue
    By yan1205 in forum Networking
    Replies: 0
    Last Post: 02-07-2012, 07:57 AM
  2. Regular Expression issue and setName() method issue
    By geforce in forum New To Java
    Replies: 2
    Last Post: 01-30-2012, 03:33 AM
  3. How do I fix this issue?
    By m4mm4l in forum New To Java
    Replies: 8
    Last Post: 11-17-2011, 03:49 AM
  4. nio issue
    By mawandiadeepak in forum Networking
    Replies: 2
    Last Post: 03-17-2010, 05:23 AM
  5. PDF Box issue
    By jazz2k8 in forum Advanced Java
    Replies: 0
    Last Post: 03-20-2009, 11:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •