/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included  with this distribution in
 * the LICENSE file.
 */
package org.apache.james.util.watchdog;

import org.apache.avalon.excalibur.pool.DefaultPool;
import org.apache.avalon.excalibur.pool.HardResourceLimitingPool;
import org.apache.avalon.excalibur.pool.ObjectFactory;
import org.apache.avalon.excalibur.pool.Pool;
import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.avalon.excalibur.thread.ThreadPool;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.logger.LogEnabled;

/**
 * This class is a factory to produce Watchdogs, each of which is associated
 * with a single thread.
 *
 * @author Peter M. Goldstein <farsight@alum.mit.edu>
 */
public class ThreadPerWatchdogFactory
    extends AbstractLogEnabled
    implements WatchdogFactory {

    /**
     * The thread pool used to generate InaccurateTimeoutWatchdogs
     */
    private ThreadPool myThreadPool;

    /**
     * The watchdog timeout for Watchdogs generated by this factory
     */
    private long timeout;

    /**
     * Creates the factory and sets the thread pool used to generate
     * InaccurateTimeoutWatchdogs.
     */
    public ThreadPerWatchdogFactory(ThreadPool theThreadPool, long timeout) {
        myThreadPool = theThreadPool;
        if (theThreadPool == null) {
            throw new IllegalArgumentException("The thread pool for the ThreadPerWatchdogFactory cannot be null.");
        }
        myThreadPool = theThreadPool;
        this.timeout = timeout;
    }

    /**
     * @see org.apache.james.util.watchdog.WatchdogFactory#getWatchdog(WatchdogTarget)
     */
    public Watchdog getWatchdog(WatchdogTarget theTarget)
            throws Exception {
        InaccurateTimeoutWatchdog watchdog = new InaccurateTimeoutWatchdog(timeout, theTarget, myThreadPool);
        watchdog.enableLogging(getLogger());
        return watchdog;
    }
}

@@ -1549,46 +1549,8 @@
 ) %7B%0A
-        myThreadPool = theThreadPool;%0A
     

Removing redundant setter statement.