Good morning Europe,

I've been digging into the Scheduler stuff in Cocoon, and I've been very pleased.. it's a component I've been waiting for for a while now, and it fits in very nicely with my main project I have going on.

I have very little experience creating Avalon components, so I thought I'd run this past -dev, to see if I'm not too far off-base. But first, a little background of what I have going on.

I'm using the Scheduler, and I have a Target which is triggered called AggregatorTarget. What this Target does is whenever it's triggered, it makes an HTTP request to a specified URL and downloads it.

The default way of having things run all the time is nice, and I've noticed that the included DefaultScheduler has things to remove targets, add targets, fire targets, etc. I'm mostly interested in "pausing" my target from firing, even if it's fired and doesn't do anything based on a flag.

Here's where my question about Avalon comes in, and how it would relate to the Cocoon Scheduler. I was thinking about implementing Suspendable in my AggregatorTarget, and including a "suspended" flag to check to see if it should actually run or not. It would be very simple, suspend() would set the suspended flag to true and resume() would set it to false.

Next comes the Target interface, which means targetTriggered(). This is what I was thinking:

public void targetTriggered(String name) {
  if (!suspended) {
     // actually trigger
  }
}

Is it this simple? Or should the DefaultScheduler or the ThreadManager be in charge of determining whether a Target should be triggered?

Sorry for all the n00b questions :)

Regards,

Tony



Reply via email to