View Javadoc

1   /*
2    * This file is part of Domingo
3    * an Open Source Java-API to Lotus Notes/Domino
4    * hosted at http://domingo.sourceforge.net
5    *
6    * Copyright (c) 2003-2007 Beck et al. projects GmbH Munich, Germany (http://www.bea.de)
7    *
8    * This library is free software; you can redistribute it and/or
9    * modify it under the terms of the GNU Lesser General Public
10   * License as published by the Free Software Foundation; either
11   * version 2.1 of the License, or (at your option) any later version.
12   *
13   * This library is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   * Lesser General Public License for more details.
17   *
18   * You should have received a copy of the GNU Lesser General Public
19   * License along with this library; if not, write to the Free Software
20   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21   */
22  package de.bea.domingo.threadpool;
23  
24  import de.bea.domingo.DNotesMonitor;
25  
26  /***
27   * Default implementation of the <code>ThreadFactory</code> interface.
28   */
29  public final class DefaultThreadFactory implements ThreadFactory {
30  
31      /*** Reference to the associated monitor. */
32      private final DNotesMonitor monitor;
33  
34      /***
35       * @param theMonitor ThreadPool monitor
36       *
37       * Default constructor.
38       */
39      public DefaultThreadFactory(final DNotesMonitor theMonitor) {
40          super();
41          this.monitor = theMonitor;
42      }
43  
44      /***
45       * {@inheritDoc}
46       * @see de.bea.domingo.threadpool.ThreadFactory#createThread(java.lang.Runnable)
47       */
48      public Thread createThread(final Runnable target) {
49          return new Thread(target);
50      }
51  
52      /***
53       * {@inheritDoc}
54       * @see de.bea.domingo.threadpool.ThreadFactory#initThread()
55       */
56      public void initThread() {
57      }
58  
59      /***
60       * {@inheritDoc}
61       * @see de.bea.domingo.threadpool.ThreadFactory#termThread()
62       */
63      public void termThread() {
64      }
65  
66      /***
67       * {@inheritDoc}
68       * @see de.bea.domingo.threadpool.ThreadFactory#handleThrowable(java.lang.Throwable)
69       */
70      public void handleThrowable(final Throwable throwable) {
71          monitor.error(throwable.getMessage(), throwable);
72      }
73  }