----- Original Message -----
From: "Peter M. Goldstein" <[EMAIL PROTECTED]>
>
> Harmeet,
>
> These are the interfaces in question.
>
> > - How is WatchdogTarget associated with Watchdog ? The association is
> not
> > apparent.
>
> The WatchdogTarget is the target for the Watchdog upon the triggering
> event.  I don't see how could find this unclear.  It's certainly at
> least as clear as the relationship between Scheduler and Target.

Secheduler has this method to associate a target.
    /**
     * Schedule a time based trigger.
     * Note that if a TimeTrigger already has same name then it is removed.
     *
     * @param name the name of the trigger
     * @param trigger the trigger
     * @param target the target
     */
    void addTrigger( String id, TimeTrigger trigger, Target target );

Watchdog does not seem to have any callback association. Is there a third
object that associates watchdog with watchdog target ?

Would it be better to have this method:
     void addTarget(WatchdogTarget targ) ;
or

change
    void startWatchdog();
to
    void startWatchdog(WatchdogTarget targ);


>
> > - From the interface it appears there is a one to one mapping between
> a
> > watched object and watchdog. This seems to impose an additional thread
> per
> > watched object. Could this lead to scalability issues. For instance if
> > there
> > are 100 threads that can be associated with a Handler, can there now
> be at
> > most 50 concurrent handlers ?
>
> There is a one to one mapping between watched object and watch dog.
> That does not imply a thread limit in generic implementations, for all
> the reasons that Noel discussed earlier.  There is such a one to one
> mapping in my Watchdog implementation.  By design.  As I've explained.
> Repeatedly.

Let us stick to the proposed interface in this email thread please.

If via watchdog mechanism one thread can be associated with n watched
objects, how would each watched object be identified at trigger time by the
thread. I realize from your email there must be a way but I don't see it.
Can you please elaborate on how this can be done ?


>
> > - Is WatchDogTarget really needed ? Can Runnable act as WatchDog
> target ?
>
> Runnable has a specific semantic meaning.  Runnable means that the class
> implementing the Runnable interface can be executed as the body of a
> thread.  That's not necessarily true for a WatchdogTarget (in fact, it
> isn't for any of the code I posted).  So no, you can't use Runnable.

Good point. But watchdog target is very generic.
Would it be better to have a generic Command interface.

/**
 * General command interface.
 */
public interface Command {
    /**
     * The method represents a command that can be executed as a callback.
     */
     void execute();
}

If you need a marker interface for enforcing strong semantics, how about

/**
 * This interface represents an action to be triggered by a watchdog
process.
 *
 * @author Andrei Ivanov
 * @author Peter M. Goldstein <[EMAIL PROTECTED]>
 */
public interface WatchdogTarget extends Command {
}

Harmeet


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to