下面列出了怎么用org.apache.hadoop.hbase.regionserver.SimpleRpcSchedulerFactory的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priorityFunction, Abortable abortable) {
// create the delegate scheduler
RpcScheduler delegate;
try {
// happens in <=0.98.4 where the scheduler factory is not visible
delegate = new SimpleRpcSchedulerFactory().create(conf, priorityFunction, abortable);
} catch (IllegalAccessError e) {
LOG.fatal(VERSION_TOO_OLD_FOR_INDEX_RPC);
throw e;
}
int indexHandlerCount = conf.getInt(QueryServices.INDEX_HANDLER_COUNT_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_HANDLER_COUNT);
int minPriority = getMinPriority(conf);
int maxPriority = conf.getInt(QueryServices.MAX_INDEX_PRIOIRTY_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_MAX_PRIORITY);
// make sure the ranges are outside the warning ranges
Preconditions.checkArgument(maxPriority > minPriority, "Max index priority (" + maxPriority
+ ") must be larger than min priority (" + minPriority + ")");
boolean allSmaller =
minPriority < HConstants.REPLICATION_QOS
&& maxPriority < HConstants.REPLICATION_QOS;
boolean allLarger = minPriority > HConstants.HIGH_QOS;
Preconditions.checkArgument(allSmaller || allLarger, "Index priority range (" + minPriority
+ ", " + maxPriority + ") must be outside HBase priority range ("
+ HConstants.REPLICATION_QOS + ", " + HConstants.HIGH_QOS + ")");
LOG.info("Using custom Phoenix Index RPC Handling with " + indexHandlerCount
+ " handlers and priority range [" + minPriority + ", " + maxPriority + ")");
PhoenixIndexRpcScheduler scheduler =
new PhoenixIndexRpcScheduler(indexHandlerCount, conf, delegate, minPriority,
maxPriority);
return scheduler;
}
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priorityFunction, Abortable abortable) {
// create the delegate scheduler
RpcScheduler delegate;
try {
// happens in <=0.98.4 where the scheduler factory is not visible
delegate = new SimpleRpcSchedulerFactory().create(conf, priorityFunction, abortable);
} catch (IllegalAccessError e) {
LOGGER.error(VERSION_TOO_OLD_FOR_INDEX_RPC);
throw e;
}
// get the index priority configs
int indexPriority = getIndexPriority(conf);
validatePriority(indexPriority);
// get the metadata priority configs
int metadataPriority = getMetadataPriority(conf);
validatePriority(metadataPriority);
// validate index and metadata priorities are not the same
Preconditions.checkArgument(indexPriority != metadataPriority, "Index and Metadata priority must not be same "+ indexPriority);
LOGGER.info("Using custom Phoenix Index RPC Handling with index rpc priority "
+ indexPriority + " and metadata rpc priority " + metadataPriority);
PhoenixRpcScheduler scheduler =
new PhoenixRpcScheduler(conf, delegate, indexPriority, metadataPriority, priorityFunction,abortable);
return scheduler;
}