Hi Mauro,

On Wed, 23 Oct 2002 01:18, Mauro Talevi wrote:
> in using the cornerstone scheduler block, the following useful
> enhancements spring to mind:
>
> 1.  PeriodicTimeTrigger - it would be useful to have a constructor with
> which to
> specify the trigger time directly,  as a oneoff triggered event.
> At present, this can be done by calculating the offset from the trigger
> time and the current time
> and using -1 as the period.
> The triggerTime variable is already used privately by the class, so I
> ask if there was any
> reason not to expose the constructor to set it.
> Perhaps, one might argue that it make it a non-periodic trigger any more
> and it should
> be implemented in a separate TimeTrigger, but I'd be more inclined to
> consider it a specific case of
> PeriodicTimeTrigger.

I would prefer a OneTimeTrigger class. It would mean that the code for the 
class is simpler and easier to understand IMHO.

> 2.  TimeScheduler - how about adding to the interface methods to manage
> the list of Triggers that have
> already been added, eg
>
> public String[] getTriggerNames();

Works for me.

> so that one can check what has been added already.
> Also, some method that return the information about the trigger
> There already is a method
>
> private TimeScheduleEntry getEntry(String name);

Instead of exposing TimeScheduleEntry which holds lots of implementation 
details that should not be exposed. It may be better to return a specially 
constructed object which people can see detail of. Something like

public class ScheduleEntry
{
  String name; //name registered under
  Trigger trigger; //trigger supplied
  long nextTime; 
}

This allows us to change implementation of TimeScheduleEntry without effecting 
users. It also stops users trying to manipulate Targets that have been 
scheduled.

Like?

> Any thoughts?  If there are no design objections I could implement the
> enhancements and send in a patch.

that would be great.

> The PeriodicTimeTrigger could also do with enhanced javadocs.

That would be even better ;)

-- 
Cheers,

Peter Donald
---------------------------------------------------
"Therefore it can be said that victorious warriors 
win first, and then go to battle, while defeated 
warriors go to battle first, and then seek to win." 
              - Sun Tzu, the Art Of War
--------------------------------------------------- 


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

Reply via email to