• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AW: WOTimer problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AW: WOTimer problem


  • Subject: Re: AW: WOTimer problem
  • From: David Teran <email@hidden>
  • Date: Sat, 17 Sep 2005 10:15:09 +0200

I know Helge really likes to do things on his own (writing an own thread instead, sorry, could not resist ;-) but in this case there is a simple solution:

Just look at the java.lang.Timer and the java.lang.TimerTask classes, here is a simple quick example:

        Timer t = new Timer();
        TimerTask tt = new TimerTask() {

            public long scheduledExecutionTime() {
                return super.scheduledExecutionTime();
            }

            public void run() {
                doSomething();
                t.schedule(tt, 1000 * 10);
            }

            public boolean cancel() {
                return super.cancel();
            }

        };
        t.schedule(tt, 1000 * 10); // start the task in 10 seconds


TimerTask is an abstract class, you can instanciate an object without creating a subclass like showed in the example. In the run method you should do whatever you want.


regards, David

On 16.09.2005, at 22:41, Helge Staedtler wrote:

I can only give you one advice:

do not use WOTimer!!

it will consume very much of your processortime if you use it excessively
and at the same time the fireing is not any longer predictive! It seems that
WOTimer is running at a very very low priority and that the timepoints to
fire are only checced occasionally. this is at least my experience.
write your own thread instead. that way you will be happier!


regards,
helge



Am 16.09.2005 18:57 Uhr schrieb "Miguel Arroz" unter <email@hidden>:


Hi!

   I have the following method:

    public void timerMethod() {
         this.doSomething();
         WOTimer.scheduledTimer( 5 * 1000,
                                this,
                                "timerMethod",
                                null,
                                null,
                                false);

     }

   I setup the timer using WOTimer.scheduledTimer( 10 * 1000, // 10
seconds from app startup
                                mailSender,
                                "timerMethod",
                                null,
                                null,
                                false);

After 10 seconds, the timer fires itself and my method is executed
and this.doSomething() run. The problem is that, after 5 seconds,
nothing happens. The timer is not rescheduled again. What's happening?


   BTW, I don't want to use the repeat flag, because I want the time
(in this sample, 5 seconds) to start counting AFTER this.doSomething
finishes, and not before.

   Yours

Miguel Arroz


"GUERRA E' PAZ LIBERDADE E' ESCRAVIDAO IGNORANCIA E' FORCA" -- 1984

Miguel Arroz
http://www.ipragma.com



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40cluster9.com


This email sent to email@hidden



_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • AW: AW: WOTimer problem
      • From: Helge Staedtler <email@hidden>
References: 
 >AW: WOTimer problem (From: Helge Staedtler <email@hidden>)

  • Prev by Date: Re: ADC Select - WebObjects. Advantages?
  • Next by Date: Re: WOBuilder, EOModeler won't launch
  • Previous by thread: AW: WOTimer problem
  • Next by thread: AW: AW: WOTimer problem
  • Index(es):
    • Date
    • Thread