View Javadoc

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  package org.apache.hadoop.hbase.master.procedure;
19  
20  import org.apache.hadoop.hbase.ServerName;
21  import org.apache.hadoop.hbase.classification.InterfaceAudience;
22  import org.apache.hadoop.hbase.classification.InterfaceStability;
23  
24  /**
25   * Procedures that handle servers -- e.g. server crash -- must implement this Interface.
26   * It is used by the procedure runner to figure locking and what queuing.
27   */
28  @InterfaceAudience.Private
29  @InterfaceStability.Evolving
30  public interface ServerProcedureInterface {
31    public enum ServerOperationType {
32      CRASH_HANDLER
33    };
34  
35    /**
36     * @return Name of this server instance.
37     */
38    ServerName getServerName();
39  
40    /**
41     * @return True if this server has an hbase:meta table region.
42     */
43    boolean hasMetaTableRegion();
44  
45    /**
46     * Given an operation type we can take decisions about what to do with pending operations.
47     * e.g. if we get a crash handler and we have some assignment operation pending
48     * we can abort those operations.
49     * @return the operation type that the procedure is executing.
50     */
51    ServerOperationType getServerOperationType();
52  }