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.procedure; 19 20 import java.io.Closeable; 21 import java.io.IOException; 22 23 import org.apache.hadoop.hbase.classification.InterfaceAudience; 24 import org.apache.hadoop.hbase.classification.InterfaceStability; 25 import org.apache.hadoop.hbase.errorhandling.ForeignException; 26 27 /** 28 * This is the notification interface for Procedures that encapsulates message passing from 29 * members to a coordinator. Each of these calls should send a message to the coordinator. 30 */ 31 @InterfaceAudience.Private 32 public interface ProcedureMemberRpcs extends Closeable { 33 34 /** 35 * Initialize and start any threads or connections the member needs. 36 */ 37 void start(final String memberName, final ProcedureMember member); 38 39 /** 40 * Each subprocedure is being executed on a member. This is the identifier for the member. 41 * @return the member name 42 */ 43 String getMemberName(); 44 45 /** 46 * Notify the coordinator that we aborted the specified {@link Subprocedure} 47 * 48 * @param sub the {@link Subprocedure} we are aborting 49 * @param cause the reason why the member's subprocedure aborted 50 * @throws IOException thrown when the rpcs can't reach the other members of the procedure (and 51 * thus can't recover). 52 */ 53 void sendMemberAborted(Subprocedure sub, ForeignException cause) throws IOException; 54 55 /** 56 * Notify the coordinator that the specified {@link Subprocedure} has acquired the locally required 57 * barrier condition. 58 * 59 * @param sub the specified {@link Subprocedure} 60 * @throws IOException if we can't reach the coordinator 61 */ 62 void sendMemberAcquired(Subprocedure sub) throws IOException; 63 64 /** 65 * Notify the coordinator that the specified {@link Subprocedure} has completed the work that 66 * needed to be done under the global barrier. 67 * 68 * @param sub the specified {@link Subprocedure} 69 * @throws IOException if we can't reach the coordinator 70 */ 71 void sendMemberCompleted(Subprocedure sub) throws IOException; 72 }