001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package org.apache.hadoop.yarn.event; 020 021 import org.apache.hadoop.classification.InterfaceAudience.Public; 022 import org.apache.hadoop.classification.InterfaceStability.Evolving; 023 024 /** 025 * Event Dispatcher interface. It dispatches events to registered 026 * event handlers based on event types. 027 * 028 */ 029 @SuppressWarnings("rawtypes") 030 @Public 031 @Evolving 032 public interface Dispatcher { 033 034 // Configuration to make sure dispatcher crashes but doesn't do system-exit in 035 // case of errors. By default, it should be false, so that tests are not 036 // affected. For all daemons it should be explicitly set to true so that 037 // daemons can crash instead of hanging around. 038 public static final String DISPATCHER_EXIT_ON_ERROR_KEY = 039 "yarn.dispatcher.exit-on-error"; 040 041 public static final boolean DEFAULT_DISPATCHER_EXIT_ON_ERROR = false; 042 043 EventHandler getEventHandler(); 044 045 void register(Class<? extends Enum> eventType, EventHandler handler); 046 047 }