Skip to content

Commit

Permalink
HBASE-26819 Minor code cleanup in and around RpcScheduler
Browse files Browse the repository at this point in the history
Signed-off-by: Duo Zhang <[email protected]>
  • Loading branch information
ndimiduk committed Mar 11, 2022
1 parent 51fd863 commit a227d76
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* 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
Expand All @@ -17,7 +17,6 @@
*/
package org.apache.hadoop.hbase.ipc;

import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
Expand All @@ -29,7 +28,6 @@
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.hbase.thirdparty.io.netty.util.internal.StringUtil;

Expand Down Expand Up @@ -92,7 +90,7 @@ public void run() {
}

@Override
public boolean dispatch(final CallRunner task) throws IOException, InterruptedException {
public boolean dispatch(final CallRunner task) {
return executeRpcCall(executor, queueSize, task);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* 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
Expand All @@ -17,7 +17,6 @@
*/
package org.apache.hadoop.hbase.ipc;

import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
Expand All @@ -29,6 +28,7 @@
import org.apache.yetus.audience.InterfaceStability;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;

import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;

Expand Down Expand Up @@ -90,7 +90,7 @@ public void stop() {
}

@Override
public boolean dispatch(final CallRunner task) throws IOException, InterruptedException {
public boolean dispatch(final CallRunner task) {
String method = getCallMethod(task);
if (rsReportExecutor != null && method != null && method.equals(REGION_SERVER_REPORT)) {
return executeRpcCall(rsReportExecutor, rsReportQueueSize, task);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* 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
Expand All @@ -17,12 +17,10 @@
*/
package org.apache.hadoop.hbase.ipc;

import java.net.InetSocketAddress;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;

import java.io.IOException;
import java.net.InetSocketAddress;

/**
* An interface for RPC request scheduling algorithm.
Expand Down Expand Up @@ -63,7 +61,7 @@ public static abstract class Context {
*
* @param task the request to be dispatched
*/
public abstract boolean dispatch(CallRunner task) throws IOException, InterruptedException;
public abstract boolean dispatch(CallRunner task);

/** Get call queue information **/
public abstract CallQueueInfo getCallQueueInfo();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* 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
Expand All @@ -21,10 +21,10 @@
import org.apache.hadoop.hbase.Abortable;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HConstants;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;
import org.apache.hadoop.hbase.conf.ConfigurationObserver;
import org.apache.hadoop.hbase.master.MasterAnnotationReadingPriorityFunction;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;

/**
* The default scheduler. Configurable. Maintains isolated handler pools for general ('default'),
Expand Down Expand Up @@ -193,7 +193,7 @@ public void stop() {
}

@Override
public boolean dispatch(CallRunner callTask) throws InterruptedException {
public boolean dispatch(CallRunner callTask) {
RpcCall call = callTask.getRpcCall();
int level = priority.getPriority(call.getHeader(), call.getParam(),
call.getRequestUser().orElse(null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -74,7 +73,6 @@
import org.junit.rules.TestName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hbase.thirdparty.com.google.common.collect.Lists;

/**
Expand Down Expand Up @@ -818,7 +816,7 @@ public SpyingRpcScheduler(RpcScheduler delegate) {
}

@Override
public boolean dispatch(CallRunner task) throws IOException, InterruptedException {
public boolean dispatch(CallRunner task) {
int priority = task.getRpcCall().getPriority();

if (priority > HConstants.QOS_THRESHOLD) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* 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
Expand All @@ -20,7 +20,6 @@
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -53,7 +52,6 @@
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor;

Expand Down Expand Up @@ -90,7 +88,7 @@ public CQTBERpcScheduler(Configuration conf, int handlerCount, int priorityHandl
}

@Override
public boolean dispatch(CallRunner callTask) throws InterruptedException {
public boolean dispatch(CallRunner callTask) {
if (FAIL) {
MethodDescriptor method = callTask.getRpcCall().getMethod();
// this is for test scan, where we will send a open scanner first and then a next, and we
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* 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
Expand All @@ -18,8 +18,6 @@

package org.apache.hadoop.hbase.ipc;

import java.io.IOException;

public class DelegatingRpcScheduler extends RpcScheduler {
protected RpcScheduler delegate;

Expand Down Expand Up @@ -75,7 +73,7 @@ public int getActiveReplicationRpcHandlerCount() {
}

@Override
public boolean dispatch(CallRunner task) throws IOException, InterruptedException {
public boolean dispatch(CallRunner task) {
return delegate.dispatch(task);
}

Expand Down

0 comments on commit a227d76

Please sign in to comment.