View Javadoc

1   /*
2    *  jDTAUS Core SPI
3    *  Copyright (C) 2005 Christian Schulte
4    *  <cs@schulte.it>
5    *
6    *  This library is free software; you can redistribute it and/or
7    *  modify it under the terms of the GNU Lesser General Public
8    *  License as published by the Free Software Foundation; either
9    *  version 2.1 of the License, or any later version.
10   *
11   *  This library is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   *  Lesser General Public License for more details.
15   *
16   *  You should have received a copy of the GNU Lesser General Public
17   *  License along with this library; if not, write to the Free Software
18   *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19   *
20   */
21  package org.jdtaus.core.monitor.spi;
22  
23  import org.jdtaus.core.monitor.Task;
24  import org.jdtaus.core.monitor.TaskEventSource;
25  
26  /**
27   * Monitors tasks.
28   * <p>jDTAUS Core SPI {@code TaskMonitor} specification to be used by
29   * implementations to provide {@code TaskEvent}s to applications.</p>
30   * <p>Example: Monitoring a task<br/>
31   * <pre>
32   * Task task = new ConcreteTask();
33   * try
34   * {
35   *   // Start monitoring.
36   *   this.getTaskMonitor().monitor(task);
37   *
38   *   // Perform operations updating <i>task</i> which is now polled for changes.
39   *   ...
40   *
41   * }
42   * finally
43   * {
44   *   this.getTaskMonitor().finish(task);
45   * }</pre></p>
46   *
47   * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
48   * @version $JDTAUS: TaskMonitor.java 8641 2012-09-27 06:45:17Z schulte $
49   * @see org.jdtaus.core.container.Container
50   */
51  public interface TaskMonitor extends TaskEventSource
52  {
53      //--TaskMonitor-------------------------------------------------------------
54  
55      /**
56       * Starts monitoring a {@code Task}.
57       *
58       * @param task the task to monitor.
59       *
60       * @throws NullPointerException if {@code task} is {@code null}.
61       */
62      void monitor( Task task );
63  
64      /**
65       * Stops monitoring a {@code Task}.
66       *
67       * @param task the task to stop monitoring.
68       *
69       * @throws NullPointerException if {@code task} is {@code null}.
70       */
71      void finish( Task task );
72  
73      //-------------------------------------------------------------TaskMonitor--
74  }