HBASE-10159 Replaced deprecated interface Closeable

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1551631 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jxiang 2013-12-17 17:06:38 +00:00
parent 92410d57d8
commit e43b527702

View File

@ -20,6 +20,7 @@
package org.apache.hadoop.hbase.fs; package org.apache.hadoop.hbase.fs;
import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
@ -46,7 +47,6 @@ import org.apache.hadoop.hdfs.protocol.ClientProtocol;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlock;
import org.apache.hadoop.hdfs.protocol.LocatedBlocks; import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
import org.apache.hadoop.io.Closeable;
import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.util.Progressable; import org.apache.hadoop.util.Progressable;
import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.util.ReflectionUtils;
@ -264,12 +264,9 @@ public class HFileSystem extends FilterFileSystem {
public Object invoke(Object proxy, Method method, public Object invoke(Object proxy, Method method,
Object[] args) throws Throwable { Object[] args) throws Throwable {
try { try {
if ((args == null || args.length == 0) && "close".equals(method.getName())) { if ((args == null || args.length == 0)
if (cp instanceof Closeable) { && "close".equals(method.getName())) {
((Closeable)cp).close(); RPC.stopProxy(cp);
} else {
RPC.stopProxy(cp);
}
return null; return null;
} else { } else {
Object res = method.invoke(cp, args); Object res = method.invoke(cp, args);
@ -380,6 +377,7 @@ public class HFileSystem extends FilterFileSystem {
* createNonRecursive. This is a hadoop bug and when it is fixed in Hadoop, * createNonRecursive. This is a hadoop bug and when it is fixed in Hadoop,
* this definition will go away. * this definition will go away.
*/ */
@SuppressWarnings("deprecation")
public FSDataOutputStream createNonRecursive(Path f, public FSDataOutputStream createNonRecursive(Path f,
boolean overwrite, boolean overwrite,
int bufferSize, short replication, long blockSize, int bufferSize, short replication, long blockSize,