本文整理汇总了Java中org.apache.hadoop.ipc.RPC.VersionMismatch类的典型用法代码示例。如果您正苦于以下问题:Java VersionMismatch类的具体用法?Java VersionMismatch怎么用?Java VersionMismatch使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VersionMismatch类属于org.apache.hadoop.ipc.RPC包,在下文中一共展示了VersionMismatch类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupBadVersionResponse
import org.apache.hadoop.ipc.RPC.VersionMismatch; //导入依赖的package包/类
/**
* Try to set up the response to indicate that the client version
* is incompatible with the server. This can contain special-case
* code to speak enough of past IPC protocols to pass back
* an exception to the caller.
* @param clientVersion the version the caller is using
* @throws IOException
*/
private void setupBadVersionResponse(int clientVersion) throws IOException {
String errMsg = "Server IPC version " + CURRENT_VERSION +
" cannot communicate with client version " + clientVersion;
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
if (clientVersion >= 3) {
// We used to return an id of -1 which caused server to close the
// connection without telling the client what the problem was. Now
// we return 0 which will keep the socket up -- bad clients, unless
// they switch to suit the running server -- will fail later doing
// getProtocolVersion.
Call fakeCall = new Call(0, null, this, responder, 0);
// Versions 3 and greater can interpret this exception
// response in the same manner
setupResponse(buffer, fakeCall, Status.FATAL,
null, VersionMismatch.class.getName(), errMsg);
responder.doRespond(fakeCall);
}
}
示例2: setupBadVersionResponse
import org.apache.hadoop.ipc.RPC.VersionMismatch; //导入依赖的package包/类
/**
* Try to set up the response to indicate that the client version
* is incompatible with the server. This can contain special-case
* code to speak enough of past IPC protocols to pass back
* an exception to the caller.
* @param clientVersion the version the caller is using
* @throws IOException
*/
private void setupBadVersionResponse(int clientVersion) throws IOException {
String errMsg = "Server IPC version " + CURRENT_VERSION +
" cannot communicate with client version " + clientVersion;
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
if (clientVersion >= 3) {
// We used to return an id of -1 which caused server to close the
// connection without telling the client what the problem was. Now
// we return 0 which will keep the socket up -- bad clients, unless
// they switch to suit the running server -- will fail later doing
// getProtocolVersion.
Call fakeCall = new Call(0, null, this, responder);
// Versions 3 and greater can interpret this exception
// response in the same manner
setupResponse(buffer, fakeCall, Status.FATAL,
null, VersionMismatch.class.getName(), errMsg);
responder.doRespond(fakeCall);
}
}
示例3: setupBadVersionResponse
import org.apache.hadoop.ipc.RPC.VersionMismatch; //导入依赖的package包/类
/**
* Try to set up the response to indicate that the client version
* is incompatible with the server. This can contain special-case
* code to speak enough of past IPC protocols to pass back
* an exception to the caller.
* @param clientVersion the version the caller is using
* @throws IOException
*/
private void setupBadVersionResponse(int clientVersion) throws IOException {
String errMsg = "Server IPC version " + CURRENT_VERSION +
" cannot communicate with client version " + clientVersion;
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
if (clientVersion >= 3) {
// We used to return an id of -1 which caused server to close the
// connection without telling the client what the problem was. Now
// we return 0 which will keep the socket up -- bad clients, unless
// they switch to suit the running server -- will fail later doing
// getProtocolVersion.
Call fakeCall = new Call(0, null, this, responder, 0, null);
// Versions 3 and greater can interpret this exception
// response in the same manner
setupResponse(buffer, fakeCall, Status.FATAL,
VersionMismatch.class.getName(), errMsg);
responder.doRespond(fakeCall);
}
}