View Javadoc

1   /*
2    ~ Copyright 2006-2007 Nicolas De Loof.
3    ~
4    ~ Licensed under the Apache License, Version 2.0 (the "License");
5    ~ you may not use this file except in compliance with the License.
6    ~ You may obtain a copy of the License at
7    ~
8    ~      http://www.apache.org/licenses/LICENSE-2.0
9    ~
10   ~ Unless required by applicable law or agreed to in writing, software
11   ~ distributed under the License is distributed on an "AS IS" BASIS,
12   ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   ~ See the License for the specific language governing permissions and
14   ~ limitations under the License.
15   */
16  package org.jmonit.events;
17  
18  import org.jmonit.Stopwatch;
19  
20  /**
21   * @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
22   */
23  public class ExecutionEvent
24      extends MonitoringEvent
25  {
26      // FIXME backport support for enums in Java 1.3 ?
27      public final static int STARTED = 1;
28  
29      public final static int STOPPED = 2;
30  
31      public final static int CANCELED = -1;
32  
33      // public enum state {
34      // STARTED, STOPPED, CANCELLED
35      // };
36  
37      private int state;
38  
39      private Stopwatch execution;
40  
41      /**
42       * @param source the probe that emitted this event
43       * @param state the probe state
44       */
45      public ExecutionEvent( Stopwatch source, int state )
46      {
47          super();
48          this.execution = source;
49          this.state = state;
50      }
51  
52      public int getState()
53      {
54          return state;
55      }
56  
57      public Stopwatch getExecution()
58      {
59          return execution;
60      }
61  
62  }