IWorkerPool plugin interface

Since an application is likely to have different kinds of workers an IWorkerPool plugin is helpful. Each type of worker has its own IWorkerPool plugin.

A worker pool is a monitoring tool for one type of worker. Monitoring can be stopped and started, with workers created or killed if there are too few or too many. Therefore every manager netlet will most likely have a worker pool for each worker type, with only the current leader actively monitoring. When leadership changes the new leader just needs to start monitoring and non-leaders need to stop.

A worker pool is also a plugin manager, so to each pool is added plugins that deal with that type of worker. Each plugin can be sure it will see only events for that worker type.

Here is the IWorkerPool interface:


public interface IWorkerPool extends IPluginManager 
{
    /**
     * Start monitoring worker pool. Worker life cycle events will get
     * passed to this pool's IWorkerLifeCycle plugins.
     * @param start_immediately  If true, a check should be made and
     *     workers should be started before start returns. If false
     *     a check will be made at the next appropriate time.
     */
    public void start(boolean start_immediately);
    
    /**
     * Stop monitoring worker pool, and possibly stop workers.
     * Worker life cycle events will no longer get passed to this pool's
     * IWorkerLifeCycle plugins.
     * @param stop_workers  If true, stop workers. If false, they can
     *     continue, but are no longer monitored by this pool.
     */
    public void stop(boolean stop_workers);
    
    /**
     * Set workers' minimum redundancy.
     * @param min  Minimum number of workers at any one time.
     */
    public void setRedundancyMin(int min);

    /**
     * Get workers' minimum redundancy.
     * @return Minimum number of workers
     */
    public int getRedundancyMin();

    /**
     * Set workers' maximum redundancy.
     * @param max Maximum number of workers at any one time.
     */
    public void setRedundancyMax(int max);

    /**
     * Get workers' maximum redundancy.
     * @return Maximum number of workers
     */
    public int getRedundancyMax();

    /**
     * Specify type label for workers. Different worker pools
     *  need different worker types.
     * @param wtype  Worker label to distinguish this pool's workers
     *               from those of other pools.
     */
    public void setWorkerType(String wtype);

    /**
     * Get worker type.
     * @return  Worker type
     */
    public String getWorkerType();
}

Nik Silver 2002-03-09