nyl3532016 commented on a change in pull request #3115: URL: https://github.com/apache/hbase/pull/3115#discussion_r612918242
########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/compactionserver/HCompactionServer.java ########## @@ -0,0 +1,299 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.compactionserver; + +import java.io.IOException; +import java.lang.reflect.Constructor; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.AbstractRpcServices; +import org.apache.hadoop.hbase.AbstractServer; +import org.apache.hadoop.hbase.ChoreService; +import org.apache.hadoop.hbase.CoordinatedStateManager; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.YouAreDeadException; +import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException; +import org.apache.hadoop.hbase.log.HBaseMarkers; +import org.apache.hadoop.hbase.security.SecurityConstants; +import org.apache.hadoop.hbase.security.Superusers; +import org.apache.hadoop.hbase.security.UserProvider; +import org.apache.hadoop.hbase.util.Sleeper; +import org.apache.hadoop.hbase.util.VersionInfo; +import org.apache.hadoop.hbase.zookeeper.MasterAddressTracker; +import org.apache.hadoop.hbase.zookeeper.ZKUtil; +import org.apache.hadoop.hbase.zookeeper.ZKWatcher; +import org.apache.hadoop.ipc.RemoteException; + +import org.apache.yetus.audience.InterfaceAudience; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.hbase.thirdparty.com.google.protobuf.BlockingRpcChannel; +import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException; + +import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; +import org.apache.hadoop.hbase.shaded.protobuf.generated.CompactionServerStatusProtos; +import org.apache.hadoop.hbase.shaded.protobuf.generated.CompactionServerStatusProtos.CompactionServerStatusService; + [email protected] +public class HCompactionServer extends AbstractServer implements CompactionServerServices { + + /** compaction server process name */ + public static final String COMPACTIONSERVER = "compactionserver"; + private static final Logger LOG = LoggerFactory.getLogger(HCompactionServer.class); + + protected String getProcessName() { + return COMPACTIONSERVER; + } + + @Override + public CoordinatedStateManager getCoordinatedStateManager() { + return null; + } + + @Override + public ChoreService getChoreService() { + return null; + } + + protected final CSRpcServices rpcServices; + + // Stub to do region server status calls against the master. + private volatile CompactionServerStatusService.BlockingInterface cssStub; + + /** + * Get the current master from ZooKeeper and open the RPC connection to it. To get a fresh + * connection, the current cssStub must be null. Method will block until a master is available. + * You can break from this block by requesting the server stop. + * @return master + port, or null if server has been stopped + */ + private synchronized ServerName createCompactionServerStatusStub() { Review comment: Abstract a method `createMasterStub`, the original return value master serverName is only used for debug, so return actual stub created instead. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
