Advertisement

03.05.2007 at 07:01AM PST, ID: 22428284
[x]
Attachment Details

java timer problem

Asked by komputer in Java Programming Language

Tags: java, timer

hi all,

i have an engine runs on weblogic at a unix machine. in my engine i have a timer and the timer writes to the log every 1 minute. but my log looks like that;

INFO 2007-03-05 15:49:41,626 aa.bb.cc.MyEngine - one minute passed...
INFO 2007-03-05 15:50:59,786 aa.bb.cc.MyEngine - one minute passed...
INFO 2007-03-05 15:52:18,414 aa.bb.cc.MyEngine - one minute passed...
INFO 2007-03-05 15:53:36,846 aa.bb.cc.MyEngine - one minute passed...
INFO 2007-03-05 15:54:55,473 aa.bb.cc.MyEngine - one minute passed...
INFO 2007-03-05 15:56:14,135 aa.bb.cc.MyEngine - one minute passed...
INFO 2007-03-05 15:57:32,463 aa.bb.cc.MyEngine - one minute passed...

why the difference between 2 log statements doesnt equal 60 second, equals about 80 second?

my code like that;

private int secondCount       = 0;
private int timerCount             = 0;
private Timer timer                  = null;
.....

public void sendData() {

      timer = new Timer();
      timer.schedule(new RemindTask(),      0, 100);

      while (notFalse) {            
            ...
      }
      ...      
      timer.cancel();
}

class RemindTask extends TimerTask {
 
public void run() {                    
        timerCount++;
        if (timerCount > 9) {      ////// when 1 second passed
                                  
              timerCount      = 0;
              ...              
              secondCount++;
              
              if (secondCount>59) {            ///////////// when 1 minute passed
                    
                    secondCount = 0;
                    logger.info("one minute passed...");                    
                    ...
              }
      }
}

thanks in advance...Start Free Trial
[+][-]03.05.2007 at 07:07AM PST, ID: 18654697

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2007 at 07:25AM PST, ID: 18654824

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Tags: java, timer
Sign Up Now!
Solution Provided By: mayankeagle
Participating Experts: 5
Solution Grade: A
 
 
[+][-]03.05.2007 at 09:21AM PST, ID: 18655773

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.05.2007 at 01:08PM PST, ID: 18657393

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.05.2007 at 02:25PM PST, ID: 18657906

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.06.2007 at 01:40AM PST, ID: 18660374

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.06.2007 at 04:49PM PST, ID: 18667064

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2007 at 10:20PM PST, ID: 18668182

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.06.2007 at 10:38PM PST, ID: 18668230

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2007 at 11:26PM PST, ID: 18668371

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.06.2007 at 11:31PM PST, ID: 18668384

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.07.2007 at 01:00AM PST, ID: 18668646

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.19.2007 at 09:23AM PDT, ID: 19726179

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.26.2007 at 04:03PM PDT, ID: 19772575

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32