1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 package org.apache.hadoop.mapreduce.jobhistory;
20 
21 import java.io.IOException;
22 
23 import org.apache.hadoop.classification.InterfaceAudience;
24 import org.apache.hadoop.classification.InterfaceStability;
25 import org.apache.hadoop.mapreduce.JobID;
26 
27 import org.apache.avro.util.Utf8;
28 
29 /**
30  * Event to record changes in the submit and launch time of
31  * a job
32  */
33 @InterfaceAudience.Private
34 @InterfaceStability.Unstable
35 public class JobInfoChangeEvent implements HistoryEvent {
36   private JobInfoChange datum = new JobInfoChange();
37 
38   /**
39    * Create a event to record the submit and launch time of a job
40    * @param id Job Id
41    * @param submitTime Submit time of the job
42    * @param launchTime Launch time of the job
43    */
JobInfoChangeEvent(JobID id, long submitTime, long launchTime)44   public JobInfoChangeEvent(JobID id, long submitTime, long launchTime) {
45     datum.jobid = new Utf8(id.toString());
46     datum.submitTime = submitTime;
47     datum.launchTime = launchTime;
48   }
49 
JobInfoChangeEvent()50   JobInfoChangeEvent() { }
51 
getDatum()52   public Object getDatum() { return datum; }
setDatum(Object datum)53   public void setDatum(Object datum) {
54     this.datum = (JobInfoChange)datum;
55   }
56 
57   /** Get the Job ID */
getJobId()58   public JobID getJobId() { return JobID.forName(datum.jobid.toString()); }
59   /** Get the Job submit time */
getSubmitTime()60   public long getSubmitTime() { return datum.submitTime; }
61   /** Get the Job launch time */
getLaunchTime()62   public long getLaunchTime() { return datum.launchTime; }
63 
getEventType()64   public EventType getEventType() {
65     return EventType.JOB_INFO_CHANGED;
66   }
67 
68 }
69