zhaoyim commented on a change in pull request #746: HBASE-23195 FSDataInputStreamWrapper unbuffer can NOT invoke the clas… URL: https://github.com/apache/hbase/pull/746#discussion_r338130227
########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java ########## @@ -270,22 +271,18 @@ public void unbuffer() { if (this.instanceOfCanUnbuffer == null) { // To ensure we compute whether the stream is instance of CanUnbuffer only once. this.instanceOfCanUnbuffer = false; - Class<?>[] streamInterfaces = streamClass.getInterfaces(); - for (Class c : streamInterfaces) { - if (c.getCanonicalName().toString().equals("org.apache.hadoop.fs.CanUnbuffer")) { - try { - this.unbuffer = streamClass.getDeclaredMethod("unbuffer"); - } catch (NoSuchMethodException | SecurityException e) { - if (isLogTraceEnabled) { - LOG.trace("Failed to find 'unbuffer' method in class " + streamClass - + " . So there may be a TCP socket connection " - + "left open in CLOSE_WAIT state.", e); - } - return; + if (CanUnbuffer.class.isAssignableFrom(streamClass)) { Review comment: @jojochuang Thanks for review! I tried your suggestion with the UT and it can pass. In my opinion, this changes should be OK, because the class implements the CanUnbuffer should implements the unbuffer() method. And have the `if (CanUnbuffer.class.isAssignableFrom(streamClass))` which make sure the `((CanUnbuffer) wrappedStream).unbuffer(); ` can be invoked. Now, just tried the UT, I want to try the changes on a real env, after testing on real env worked well, then will update the commit. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services