Github user arp7 commented on a diff in the pull request: https://github.com/apache/hadoop/pull/86#discussion_r57606818 --- Diff: hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/CallQueueManager.java --- @@ -49,25 +57,68 @@ private final AtomicReference<BlockingQueue<E>> putRef; private final AtomicReference<BlockingQueue<E>> takeRef; + private RpcScheduler scheduler; + public CallQueueManager(Class<? extends BlockingQueue<E>> backingClass, + Class<? extends RpcScheduler> schedulerClass, boolean clientBackOffEnabled, int maxQueueSize, String namespace, Configuration conf) { + int priorityLevels = parseNumLevels(namespace, conf); + this.scheduler = createScheduler(schedulerClass, priorityLevels, + namespace, conf); BlockingQueue<E> bq = createCallQueueInstance(backingClass, - maxQueueSize, namespace, conf); + priorityLevels, maxQueueSize, namespace, conf); this.clientBackOffEnabled = clientBackOffEnabled; this.putRef = new AtomicReference<BlockingQueue<E>>(bq); this.takeRef = new AtomicReference<BlockingQueue<E>>(bq); LOG.info("Using callQueue " + backingClass); } + private static <T extends RpcScheduler> T createScheduler( + Class<T> theClass, int priorityLevels, String ns, Configuration conf) { + // Used for custom, configurable scheduler + try { + Constructor<T> ctor = theClass.getDeclaredConstructor(int.class, + String.class, Configuration.class); + return ctor.newInstance(priorityLevels, ns, conf); + } catch (RuntimeException e) { --- End diff -- See HDFS-9478 which is fixing exception handling when constructing callqueue instances. We could use a similar fix for createScheduler.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---