|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.apache.spark; |
| 19 | + |
| 20 | +import org.apache.spark.scheduler.SparkListener; |
| 21 | +import org.apache.spark.scheduler.SparkListenerApplicationEnd; |
| 22 | +import org.apache.spark.scheduler.SparkListenerApplicationStart; |
| 23 | +import org.apache.spark.scheduler.SparkListenerBlockManagerAdded; |
| 24 | +import org.apache.spark.scheduler.SparkListenerBlockManagerRemoved; |
| 25 | +import org.apache.spark.scheduler.SparkListenerEnvironmentUpdate; |
| 26 | +import org.apache.spark.scheduler.SparkListenerExecutorAdded; |
| 27 | +import org.apache.spark.scheduler.SparkListenerExecutorMetricsUpdate; |
| 28 | +import org.apache.spark.scheduler.SparkListenerExecutorRemoved; |
| 29 | +import org.apache.spark.scheduler.SparkListenerJobEnd; |
| 30 | +import org.apache.spark.scheduler.SparkListenerJobStart; |
| 31 | +import org.apache.spark.scheduler.SparkListenerStageCompleted; |
| 32 | +import org.apache.spark.scheduler.SparkListenerStageSubmitted; |
| 33 | +import org.apache.spark.scheduler.SparkListenerTaskEnd; |
| 34 | +import org.apache.spark.scheduler.SparkListenerTaskGettingResult; |
| 35 | +import org.apache.spark.scheduler.SparkListenerTaskStart; |
| 36 | +import org.apache.spark.scheduler.SparkListenerUnpersistRDD; |
| 37 | + |
| 38 | +/** |
| 39 | + * Java clients should extend this class instead of implementing |
| 40 | + * SparkListener directly. This is to prevent java clients |
| 41 | + * from breaking when new events are added to the SparkListener |
| 42 | + * trait. |
| 43 | + * |
| 44 | + * This is a concrete class instead of abstract to enforce |
| 45 | + * new events get added to both the SparkListener and this adapter |
| 46 | + * in lockstep. |
| 47 | + */ |
| 48 | +public class JavaSparkListener implements SparkListener { |
| 49 | + |
| 50 | + @Override |
| 51 | + public void onStageCompleted(SparkListenerStageCompleted stageCompleted) { } |
| 52 | + |
| 53 | + @Override |
| 54 | + public void onStageSubmitted(SparkListenerStageSubmitted stageSubmitted) { } |
| 55 | + |
| 56 | + @Override |
| 57 | + public void onTaskStart(SparkListenerTaskStart taskStart) { } |
| 58 | + |
| 59 | + @Override |
| 60 | + public void onTaskGettingResult(SparkListenerTaskGettingResult taskGettingResult) { } |
| 61 | + |
| 62 | + @Override |
| 63 | + public void onTaskEnd(SparkListenerTaskEnd taskEnd) { } |
| 64 | + |
| 65 | + @Override |
| 66 | + public void onJobStart(SparkListenerJobStart jobStart) { } |
| 67 | + |
| 68 | + @Override |
| 69 | + public void onJobEnd(SparkListenerJobEnd jobEnd) { } |
| 70 | + |
| 71 | + @Override |
| 72 | + public void onEnvironmentUpdate(SparkListenerEnvironmentUpdate environmentUpdate) { } |
| 73 | + |
| 74 | + @Override |
| 75 | + public void onBlockManagerAdded(SparkListenerBlockManagerAdded blockManagerAdded) { } |
| 76 | + |
| 77 | + @Override |
| 78 | + public void onBlockManagerRemoved(SparkListenerBlockManagerRemoved blockManagerRemoved) { } |
| 79 | + |
| 80 | + @Override |
| 81 | + public void onUnpersistRDD(SparkListenerUnpersistRDD unpersistRDD) { } |
| 82 | + |
| 83 | + @Override |
| 84 | + public void onApplicationStart(SparkListenerApplicationStart applicationStart) { } |
| 85 | + |
| 86 | + @Override |
| 87 | + public void onApplicationEnd(SparkListenerApplicationEnd applicationEnd) { } |
| 88 | + |
| 89 | + @Override |
| 90 | + public void onExecutorMetricsUpdate(SparkListenerExecutorMetricsUpdate executorMetricsUpdate) { } |
| 91 | + |
| 92 | + @Override |
| 93 | + public void onExecutorAdded(SparkListenerExecutorAdded executorAdded) { } |
| 94 | + |
| 95 | + @Override |
| 96 | + public void onExecutorRemoved(SparkListenerExecutorRemoved executorRemoved) { } |
| 97 | +} |
0 commit comments