File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -377,9 +377,21 @@ public void setDelegate(FairCallQueue<? extends Schedulable> obj) {
377377 this .revisionNumber ++;
378378 }
379379
380+ /**
381+ * Fetch the current call queue from the weak reference delegate. If there
382+ * is no delegate, or the delegate is empty, this will return null.
383+ */
384+ private FairCallQueue <? extends Schedulable > getCallQueue () {
385+ WeakReference <FairCallQueue <? extends Schedulable >> ref = this .delegate ;
386+ if (ref == null ) {
387+ return null ;
388+ }
389+ return ref .get ();
390+ }
391+
380392 @ Override
381393 public int [] getQueueSizes () {
382- FairCallQueue <? extends Schedulable > obj = this . delegate . get ();
394+ FairCallQueue <? extends Schedulable > obj = getCallQueue ();
383395 if (obj == null ) {
384396 return new int []{};
385397 }
@@ -389,7 +401,7 @@ public int[] getQueueSizes() {
389401
390402 @ Override
391403 public long [] getOverflowedCalls () {
392- FairCallQueue <? extends Schedulable > obj = this . delegate . get ();
404+ FairCallQueue <? extends Schedulable > obj = getCallQueue ();
393405 if (obj == null ) {
394406 return new long []{};
395407 }
You can’t perform that action at this time.
0 commit comments