1 /** 2 * Copyright 2010 The Apache Software Foundation 3 * 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 package org.apache.hadoop.hbase.master; 21 22 import java.io.IOException; 23 24 import org.apache.hadoop.hbase.HMsg; 25 import org.apache.hadoop.hbase.HServerInfo; 26 27 /** 28 * Listener for regionserver events in master. 29 * @see HMaster#registerRegionServerOperationListener(RegionServerOperationListener) 30 * @see HMaster#unregisterRegionServerOperationListener(RegionServerOperationListener) 31 */ 32 public interface RegionServerOperationListener { 33 /** 34 * Called for each message passed the master. Most of the messages that come 35 * in here will go on to become {@link #process(RegionServerOperation)}s but 36 * others like {@linke HMsg.Type#MSG_REPORT_PROCESS_OPEN} go no further; 37 * only in here can you see them come in. 38 * @param serverInfo Server we got the message from. 39 * @param incomingMsg The message received. 40 * @return True to continue processing, false to skip. 41 */ 42 public boolean process(final HServerInfo serverInfo, 43 final HMsg incomingMsg); 44 45 /** 46 * Called before processing <code>op</code> 47 * @param op 48 * @return True if we are to proceed w/ processing. 49 * @exception IOException 50 */ 51 public boolean process(final RegionServerOperation op) throws IOException; 52 53 /** 54 * Called after <code>op</code> has been processed. 55 * @param op The operation that just completed. 56 */ 57 public void processed(final RegionServerOperation op); 58 }