diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java index 93f03f0..716bd40 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java @@ -33,7 +33,6 @@ import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.protobuf.generated.FSProtos; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.io.Writable; import com.google.protobuf.ByteString; @@ -56,7 +55,7 @@ import com.google.protobuf.ByteString; * references. References are cleaned up by compactions. */ @InterfaceAudience.Private -public class Reference implements Writable { +public class Reference { private byte [] splitkey; private Range region; @@ -99,7 +98,6 @@ public class Reference implements Writable { /** * Used by serializations. - * @deprecated Use the pb serializations instead. Writables are going away. */ @Deprecated // Make this private when it comes time to let go of this constructor. Needed by pb serialization. @@ -130,27 +128,6 @@ public class Reference implements Writable { return "" + this.region; } - /** - * @deprecated Writables are going away. Use the pb serialization methods instead. - */ - @Deprecated - public void write(DataOutput out) throws IOException { - // Write true if we're doing top of the file. - out.writeBoolean(isTopFileRegion(this.region)); - Bytes.writeByteArray(out, this.splitkey); - } - - /** - * @deprecated Writables are going away. Use the pb serialization methods instead. - */ - @Deprecated - public void readFields(DataInput in) throws IOException { - boolean tmp = in.readBoolean(); - // If true, set region to top. - this.region = tmp? Range.top: Range.bottom; - this.splitkey = Bytes.readByteArray(in); - } - public static boolean isTopFileRegion(final Range r) { return r.equals(Range.top); } @@ -167,6 +144,17 @@ public class Reference implements Writable { } /** + * @deprecated Writables are going away. Use the pb serialization methods instead. + */ + @Deprecated + public void readFields(DataInput in) throws IOException { + boolean tmp = in.readBoolean(); + // If true, set region to top. + this.region = tmp? Range.top: Range.bottom; + this.splitkey = Bytes.readByteArray(in); + } + + /** * Read a Reference from FileSystem. * @param fs * @param p diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/TimeRange.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/TimeRange.java index 2320582..1df344c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/TimeRange.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/TimeRange.java @@ -23,8 +23,6 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -import org.apache.hadoop.io.Writable; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hbase.util.Bytes; @@ -39,7 +37,7 @@ import org.apache.hadoop.hbase.util.Bytes; */ @InterfaceAudience.Public @InterfaceStability.Stable -public class TimeRange implements Writable { +public class TimeRange { private long minStamp = 0L; private long maxStamp = Long.MAX_VALUE; private boolean allTime = false; @@ -184,17 +182,4 @@ public class TimeRange implements Writable { sb.append(this.minStamp); return sb.toString(); } - - //Writable - public void readFields(final DataInput in) throws IOException { - this.minStamp = in.readLong(); - this.maxStamp = in.readLong(); - this.allTime = in.readBoolean(); - } - - public void write(final DataOutput out) throws IOException { - out.writeLong(minStamp); - out.writeLong(maxStamp); - out.writeBoolean(this.allTime); - } -} +} \ No newline at end of file diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ClientCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ClientCache.java index f33f59c..b711243 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ClientCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ClientCache.java @@ -27,8 +27,6 @@ import javax.net.SocketFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.io.HbaseObjectWritable; -import org.apache.hadoop.io.Writable; /** * Cache a client using its socket factory as the hash key. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java index b770354..300cacc 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java @@ -1339,7 +1339,6 @@ public class HBaseClient { * @param exception the relevant exception * @return an exception to throw */ - @SuppressWarnings({"ThrowableInstanceNeverThrown"}) protected IOException wrapException(InetSocketAddress addr, IOException exception) { if (exception instanceof ConnectException) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java index 884db91..92f9c45 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java @@ -46,18 +46,17 @@ import java.nio.channels.WritableByteChannel; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Random; -import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.atomic.AtomicInteger; import javax.security.sasl.Sasl; import javax.security.sasl.SaslException; @@ -68,28 +67,28 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler; +import org.apache.hadoop.hbase.monitoring.TaskMonitor; import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.ConnectionHeader; import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcException; import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcRequestBody; import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcRequestHeader; import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcResponseHeader; -import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.UserInformation; import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcResponseHeader.Status; -import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler; -import org.apache.hadoop.hbase.monitoring.TaskMonitor; -import org.apache.hadoop.hbase.security.User; +import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.UserInformation; import org.apache.hadoop.hbase.security.HBaseSaslRpcServer; import org.apache.hadoop.hbase.security.HBaseSaslRpcServer.AuthMethod; import org.apache.hadoop.hbase.security.HBaseSaslRpcServer.SaslDigestCallbackHandler; import org.apache.hadoop.hbase.security.HBaseSaslRpcServer.SaslGssCallbackHandler; import org.apache.hadoop.hbase.security.HBaseSaslRpcServer.SaslStatus; +import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.util.ByteBufferOutputStream; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableUtils; -import org.apache.hadoop.ipc.Server; import org.apache.hadoop.ipc.RPC.VersionMismatch; +import org.apache.hadoop.ipc.Server; import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod; @@ -97,20 +96,20 @@ import org.apache.hadoop.security.authorize.AuthorizationException; import org.apache.hadoop.security.authorize.ProxyUsers; import org.apache.hadoop.security.authorize.ServiceAuthorizationManager; import org.apache.hadoop.security.token.SecretManager; -import org.apache.hadoop.security.token.TokenIdentifier; import org.apache.hadoop.security.token.SecretManager.InvalidToken; +import org.apache.hadoop.security.token.TokenIdentifier; import org.apache.hadoop.util.StringUtils; - -import com.google.common.base.Function; -import com.google.common.util.concurrent.ThreadFactoryBuilder; -import com.google.protobuf.Message; - import org.cliffc.high_scale_lib.Counter; import org.cloudera.htrace.Sampler; import org.cloudera.htrace.Span; +import org.cloudera.htrace.Trace; import org.cloudera.htrace.TraceInfo; import org.cloudera.htrace.impl.NullSpan; -import org.cloudera.htrace.Trace; + +import com.google.common.base.Function; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.google.protobuf.Message; +// Uses Writables doing sasl /** A client for an IPC service. IPC calls take a single Protobuf message as a * parameter, and return a single Protobuf message as their value. A service runs on @@ -169,10 +168,6 @@ public abstract class HBaseServer implements RpcServer { new ThreadLocal(); private volatile boolean started = false; - // For generated protocol classes which doesn't have VERSION field - private static final Map, Long> - PROTOCOL_VERSION = new HashMap, Long>(); - private static final Map> PROTOCOL_CACHE = new ConcurrentHashMap>(); @@ -263,8 +258,6 @@ public abstract class HBaseServer implements RpcServer { protected int highPriorityLevel; // what level a high priority call is at - private volatile int responseQueueLen; // size of response queue for this server - protected final List connectionList = Collections.synchronizedList(new LinkedList()); //maintain a list @@ -1000,7 +993,6 @@ public abstract class HBaseServer implements RpcServer { return true; } if (!call.response.hasRemaining()) { - responseQueueLen--; call.connection.decRpcCount(); //noinspection RedundantIfStatement if (numElements == 1) { // last call fully processes. @@ -1070,7 +1062,6 @@ public abstract class HBaseServer implements RpcServer { void doRespond(Call call) throws IOException { // set the serve time when the response has to be sent later call.timestamp = System.currentTimeMillis(); - responseQueueLen++; boolean doRegister = false; synchronized (call.connection.responseQueue) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java deleted file mode 100644 index 574647c..0000000 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.hbase.ipc; - -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.conf.Configurable; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.client.AdminProtocol; -import org.apache.hadoop.hbase.client.ClientProtocol; -import org.apache.hadoop.hbase.MasterMonitorProtocol; -import org.apache.hadoop.hbase.MasterAdminProtocol; -import org.apache.hadoop.hbase.io.HbaseObjectWritable; -import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService; -import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; -import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionServerStatusService; -import org.apache.hadoop.hbase.RegionServerStatusProtocol; -import org.apache.hadoop.io.VersionMismatchException; -import org.apache.hadoop.io.VersionedWritable; - -/** A method invocation, including the method name and its parameters.*/ -@InterfaceAudience.Private -public class Invocation extends VersionedWritable implements Configurable { - protected String methodName; - @SuppressWarnings("rawtypes") - protected Class[] parameterClasses; - protected Object[] parameters; - protected Configuration conf; - private long clientVersion; - private int clientMethodsHash; - - // For generated protocol classes which don't have VERSION field, - // such as protobuf interfaces. - static final Map, Long> - PROTOCOL_VERSION = new HashMap, Long>(); - - static { - PROTOCOL_VERSION.put(ClientService.BlockingInterface.class, - Long.valueOf(ClientProtocol.VERSION)); - PROTOCOL_VERSION.put(AdminService.BlockingInterface.class, - Long.valueOf(AdminProtocol.VERSION)); - PROTOCOL_VERSION.put(RegionServerStatusService.BlockingInterface.class, - Long.valueOf(RegionServerStatusProtocol.VERSION)); - PROTOCOL_VERSION.put(MasterMonitorProtocol.class,Long.valueOf(MasterMonitorProtocol.VERSION)); - PROTOCOL_VERSION.put(MasterAdminProtocol.class,Long.valueOf(MasterAdminProtocol.VERSION)); - } - - // For protobuf protocols, which use ServiceException, instead of IOException - protected static final Set> - PROTOBUF_PROTOCOLS = new HashSet>(); - - static { - PROTOBUF_PROTOCOLS.add(ClientProtocol.class); - PROTOBUF_PROTOCOLS.add(AdminProtocol.class); - PROTOBUF_PROTOCOLS.add(RegionServerStatusProtocol.class); - PROTOBUF_PROTOCOLS.add(MasterMonitorProtocol.class); - PROTOBUF_PROTOCOLS.add(MasterAdminProtocol.class); - } - - private static byte RPC_VERSION = 1; - - public Invocation() {} - - public Invocation(Method method, Object[] parameters) { - this.methodName = method.getName(); - this.parameterClasses = method.getParameterTypes(); - this.parameters = parameters; - Class declaringClass = method.getDeclaringClass(); - if (declaringClass.equals(VersionedProtocol.class)) { - //VersionedProtocol is exempted from version check. - clientVersion = 0; - clientMethodsHash = 0; - } else { - try { - Long version = PROTOCOL_VERSION.get(declaringClass); - if (version != null) { - this.clientVersion = version.longValue(); - } else { - Field versionField = declaringClass.getField("VERSION"); - versionField.setAccessible(true); - this.clientVersion = versionField.getLong(declaringClass); - } - } catch (NoSuchFieldException ex) { - throw new RuntimeException("The " + declaringClass, ex); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex); - } - this.clientMethodsHash = ProtocolSignature.getFingerprint( - declaringClass.getMethods()); - } - } - - /** @return The name of the method invoked. */ - public String getMethodName() { return methodName; } - - /** @return The parameter classes. */ - @SuppressWarnings({ "rawtypes" }) - public Class[] getParameterClasses() { return parameterClasses; } - - /** @return The parameter instances. */ - public Object[] getParameters() { return parameters; } - - long getProtocolVersion() { - return clientVersion; - } - - protected int getClientMethodsHash() { - return clientMethodsHash; - } - - /** - * Returns the rpc version used by the client. - * @return rpcVersion - */ - public long getRpcVersion() { - return RPC_VERSION; - } - - public void readFields(DataInput in) throws IOException { - try { - super.readFields(in); - methodName = in.readUTF(); - clientVersion = in.readLong(); - clientMethodsHash = in.readInt(); - } catch (VersionMismatchException e) { - // VersionMismatchException doesn't provide an API to access - // expectedVersion and foundVersion. This is really sad. - if (e.toString().endsWith("found v0")) { - // Try to be a bit backwards compatible. In previous versions of - // HBase (before HBASE-3939 in 0.92) Invocation wasn't a - // VersionedWritable and thus the first thing on the wire was always - // the 2-byte length of the method name. Because no method name is - // longer than 255 characters, and all method names are in ASCII, - // The following code is equivalent to `in.readUTF()', which we can't - // call again here, because `super.readFields(in)' already consumed - // the first byte of input, which can't be "unread" back into `in'. - final short len = (short) (in.readByte() & 0xFF); // Unsigned byte. - final byte[] buf = new byte[len]; - in.readFully(buf, 0, len); - methodName = new String(buf); - } - } - parameters = new Object[in.readInt()]; - parameterClasses = new Class[parameters.length]; - HbaseObjectWritable objectWritable = new HbaseObjectWritable(); - for (int i = 0; i < parameters.length; i++) { - parameters[i] = HbaseObjectWritable.readObject(in, objectWritable, - this.conf); - parameterClasses[i] = objectWritable.getDeclaredClass(); - } - } - - public void write(DataOutput out) throws IOException { - super.write(out); - out.writeUTF(this.methodName); - out.writeLong(clientVersion); - out.writeInt(clientMethodsHash); - out.writeInt(parameterClasses.length); - for (int i = 0; i < parameterClasses.length; i++) { - HbaseObjectWritable.writeObject(out, parameters[i], parameterClasses[i], - conf); - } - } - - @Override - public String toString() { - StringBuilder buffer = new StringBuilder(256); - buffer.append(methodName); - buffer.append("("); - for (int i = 0; i < parameters.length; i++) { - if (i != 0) - buffer.append(", "); - buffer.append(parameters[i]); - } - buffer.append(")"); - buffer.append(", rpc version="+RPC_VERSION); - buffer.append(", client version="+clientVersion); - buffer.append(", methodsFingerPrint="+clientMethodsHash); - return buffer.toString(); - } - - public void setConf(Configuration conf) { - this.conf = conf; - } - - public Configuration getConf() { - return this.conf; - } - - @Override - public byte getVersion() { - return RPC_VERSION; - } -} diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MasterCoprocessorRpcChannel.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MasterCoprocessorRpcChannel.java index b3a4228..6971b34 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MasterCoprocessorRpcChannel.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MasterCoprocessorRpcChannel.java @@ -18,26 +18,20 @@ package org.apache.hadoop.hbase.ipc; -import com.google.protobuf.BlockingRpcChannel; -import com.google.protobuf.ByteString; -import com.google.protobuf.Descriptors; -import com.google.protobuf.Message; -import com.google.protobuf.RpcCallback; -import com.google.protobuf.RpcChannel; -import com.google.protobuf.RpcController; -import com.google.protobuf.ServiceException; +import java.io.IOException; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.HConnection; import org.apache.hadoop.hbase.protobuf.ProtobufUtil; -import org.apache.hadoop.hbase.protobuf.ResponseConverter; import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; +import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse; -import java.io.IOException; - -import static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse; +import com.google.protobuf.ByteString; +import com.google.protobuf.Descriptors; +import com.google.protobuf.Message; /** * Provides clients with an RPC connection to call coprocessor endpoint {@link com.google.protobuf.Service}s diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java index 8e33c1d..7911c94 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServer.java @@ -19,14 +19,11 @@ package org.apache.hadoop.hbase.ipc; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hbase.CompatibilitySingletonFactory; @InterfaceAudience.Private public class MetricsHBaseServer { - private static Log LOG = LogFactory.getLog(MetricsHBaseServer.class); private MetricsHBaseServerSource source; public MetricsHBaseServer(String serverName, MetricsHBaseServerWrapper wrapper) { @@ -69,4 +66,4 @@ public class MetricsHBaseServer { public MetricsHBaseServerSource getMetricsSource() { return source; } -} +} \ No newline at end of file diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcClientEngine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcClientEngine.java index 46873ab..0671184 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcClientEngine.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcClientEngine.java @@ -24,7 +24,15 @@ import com.google.protobuf.ServiceException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.MasterAdminProtocol; +import org.apache.hadoop.hbase.MasterMonitorProtocol; +import org.apache.hadoop.hbase.RegionServerStatusProtocol; +import org.apache.hadoop.hbase.client.AdminProtocol; +import org.apache.hadoop.hbase.client.ClientProtocol; +import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService; +import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService; import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcRequestBody; +import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionServerStatusService; import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.ipc.RemoteException; @@ -34,6 +42,7 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.net.InetSocketAddress; +import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -76,6 +85,21 @@ public class ProtobufRpcClientEngine implements RpcClientEngine { final private int rpcTimeout; private final long clientProtocolVersion; + // For generated protocol classes which don't have VERSION field, + // such as protobuf interfaces. + static final Map, Long> + PROTOCOL_VERSION = new HashMap, Long>(); + static { + PROTOCOL_VERSION.put(ClientService.BlockingInterface.class, + Long.valueOf(ClientProtocol.VERSION)); + PROTOCOL_VERSION.put(AdminService.BlockingInterface.class, + Long.valueOf(AdminProtocol.VERSION)); + PROTOCOL_VERSION.put(RegionServerStatusService.BlockingInterface.class, + Long.valueOf(RegionServerStatusProtocol.VERSION)); + PROTOCOL_VERSION.put(MasterMonitorProtocol.class,Long.valueOf(MasterMonitorProtocol.VERSION)); + PROTOCOL_VERSION.put(MasterAdminProtocol.class,Long.valueOf(MasterAdminProtocol.VERSION)); + } + public Invoker(Class protocol, InetSocketAddress addr, User ticket, Configuration conf, SocketFactory factory, int rpcTimeout) throws IOException { @@ -84,7 +108,7 @@ public class ProtobufRpcClientEngine implements RpcClientEngine { this.ticket = ticket; this.client = CLIENTS.getClient(conf, factory); this.rpcTimeout = rpcTimeout; - Long version = Invocation.PROTOCOL_VERSION.get(protocol); + Long version = PROTOCOL_VERSION.get(protocol); if (version != null) { this.clientProtocolVersion = version; } else { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcServerEngine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcServerEngine.java index 3317af3..c3882a5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcServerEngine.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcServerEngine.java @@ -36,10 +36,9 @@ import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcRequestBody; import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.security.HBasePolicyProvider; -import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.security.token.AuthenticationTokenSecretManager; -import org.apache.hadoop.security.authorize.ServiceAuthorizationManager; import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.security.authorize.ServiceAuthorizationManager; import org.codehaus.jackson.map.ObjectMapper; import com.google.protobuf.Message; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/UnknownProtocolException.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/UnknownProtocolException.java index a49ea95..36af923 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/UnknownProtocolException.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/UnknownProtocolException.java @@ -24,6 +24,7 @@ import org.apache.hadoop.hbase.DoNotRetryIOException; /** * An error requesting an RPC protocol that the server is not serving. */ +@SuppressWarnings("serial") public class UnknownProtocolException extends DoNotRetryIOException { private Class protocol; @@ -44,4 +45,4 @@ public class UnknownProtocolException extends DoNotRetryIOException { public Class getProtocol() { return protocol; } -} +} \ No newline at end of file diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java index 3606a8c..daec64e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java @@ -149,5 +149,4 @@ public class TimeRangeTracker implements Writable { return "[" + minimumTimestamp + "," + maximumTimestamp + "]"; } -} - +} \ No newline at end of file diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestSerialization.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestSerialization.java index 3f7edd0..3316179 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestSerialization.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestSerialization.java @@ -521,17 +521,6 @@ public class TestSerialization { } */ - @Test public void testTimeRange() throws Exception{ - TimeRange tr = new TimeRange(0,5); - byte [] mb = Writables.getBytes(tr); - TimeRange deserializedTr = - (TimeRange)Writables.getWritable(mb, new TimeRange()); - - assertEquals(tr.getMax(), deserializedTr.getMax()); - assertEquals(tr.getMin(), deserializedTr.getMin()); - - } - protected static final int MAXVERSIONS = 3; protected final static byte [] fam1 = Bytes.toBytes("colfamily1"); protected final static byte [] fam2 = Bytes.toBytes("colfamily2");