svn merge -c 1215358 from trunk for HADOOP-7931.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23-PB@1230898 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2012-01-13 04:36:54 +00:00
parent 5fd8fb6a7d
commit 34d92b4f2d
2 changed files with 31 additions and 7 deletions

View File

@ -50,6 +50,9 @@ Release 0.23-PB - Unreleased
HADOOP-7892. IPC logs too verbose after "RpcKind" introduction (todd) HADOOP-7892. IPC logs too verbose after "RpcKind" introduction (todd)
HADOOP-7931. o.a.h.ipc.WritableRpcEngine should have a way to force
initialization (atm)
Release 0.23.1 - Unreleased Release 0.23.1 - Unreleased
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -48,17 +48,38 @@ import org.apache.hadoop.conf.*;
public class WritableRpcEngine implements RpcEngine { public class WritableRpcEngine implements RpcEngine {
private static final Log LOG = LogFactory.getLog(RPC.class); private static final Log LOG = LogFactory.getLog(RPC.class);
static { // Register the rpcRequest deserializer for WritableRpcEngine
org.apache.hadoop.ipc.Server.registerProtocolEngine(RpcKind.RPC_WRITABLE,
Invocation.class, new Server.WritableRpcInvoker());
}
//writableRpcVersion should be updated if there is a change //writableRpcVersion should be updated if there is a change
//in format of the rpc messages. //in format of the rpc messages.
// 2L - added declared class to Invocation // 2L - added declared class to Invocation
public static final long writableRpcVersion = 2L; public static final long writableRpcVersion = 2L;
/**
* Whether or not this class has been initialized.
*/
private static boolean isInitialized = false;
static {
ensureInitialized();
}
/**
* Initialize this class if it isn't already.
*/
public static synchronized void ensureInitialized() {
if (!isInitialized) {
initialize();
}
}
/**
* Register the rpcRequest deserializer for WritableRpcEngine
*/
private static synchronized void initialize() {
org.apache.hadoop.ipc.Server.registerProtocolEngine(RpcKind.RPC_WRITABLE,
Invocation.class, new Server.WritableRpcInvoker());
isInitialized = true;
}
/** A method invocation, including the method name and its parameters.*/ /** A method invocation, including the method name and its parameters.*/