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