当前位置: 首页>>代码示例>>Java>>正文


Java VersionMismatch类代码示例

本文整理汇总了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);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:HBaseServer.java

示例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);
  }
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:29,代码来源:HBaseServer.java

示例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);
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:29,代码来源:HBaseServer.java


注:本文中的org.apache.hadoop.ipc.RPC.VersionMismatch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。