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


Java Operation类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.client.Operation的典型用法代码示例。如果您正苦于以下问题:Java Operation类的具体用法?Java Operation怎么用?Java Operation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Operation类属于org.apache.hadoop.hbase.client包,在下文中一共展示了Operation类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isOperationRunning

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
/**
 * Indicates to the client whether this task is monitoring a currently active 
 * RPC call to a database command. (as defined by 
 * o.a.h.h.client.Operation)
 * @return true if the monitored handler is currently servicing an RPC call
 * to a database command.
 */
public synchronized boolean isOperationRunning() {
  if(!isRPCRunning()) {
    return false;
  }
  for(Object param : params) {
    if (param instanceof Operation) {
      return true;
    }
  }
  return false;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:MonitoredRPCHandlerImpl.java

示例2: toMap

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
public synchronized Map<String, Object> toMap() {
  // only include RPC info if the Handler is actively servicing an RPC call
  Map<String, Object> map = super.toMap();
  if (getState() != State.RUNNING) {
    return map;
  }
  Map<String, Object> rpcJSON = new HashMap<String, Object>();
  ArrayList paramList = new ArrayList();
  map.put("rpcCall", rpcJSON);
  rpcJSON.put("queuetimems", getRPCQueueTime());
  rpcJSON.put("starttimems", getRPCStartTime());
  rpcJSON.put("clientaddress", clientAddress);
  rpcJSON.put("remoteport", remotePort);
  rpcJSON.put("packetlength", getRPCPacketLength());
  rpcJSON.put("method", methodName);
  rpcJSON.put("params", paramList);
  for(Object param : params) {
    if(param instanceof byte []) {
      paramList.add(Bytes.toStringBinary((byte []) param));
    } else if (param instanceof Operation) {
      paramList.add(((Operation) param).toMap());
    } else {
      paramList.add(param.toString());
    }
  }
  return map;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:MonitoredRPCHandlerImpl.java

示例3: isOperationRunning

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
/**
 * Indicates to the client whether this task is monitoring a currently active 
 * RPC call to a database command. (as defined by 
 * o.a.h.h.client.Operation)
 * @return true if the monitored handler is currently servicing an RPC call
 * to a database command.
 */
public boolean isOperationRunning() {
  if(!isRPCRunning()) {
    return false;
  }
  for(Object param : params) {
    if (param instanceof Operation) {
      return true;
    }
  }
  return false;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:19,代码来源:MonitoredRPCHandlerImpl.java

示例4: isOperationRunning

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
/**
 * Indicates to the client whether this task is monitoring a currently active 
 * RPC call to a database command. (as defined by 
 * o.a.h.h.client.Operation)
 * @return true if the monitored handler is currently servicing an RPC call
 * to a database command.
 */
@Override
public synchronized boolean isOperationRunning() {
  if(!isRPCRunning()) {
    return false;
  }
  for(Object param : params) {
    if (param instanceof Operation) {
      return true;
    }
  }
  return false;
}
 
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:MonitoredRPCHandlerImpl.java

示例5: toMap

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
@Override
public synchronized Map<String, Object> toMap() {
  // only include RPC info if the Handler is actively servicing an RPC call
  Map<String, Object> map = super.toMap();
  if (getState() != State.RUNNING) {
    return map;
  }
  Map<String, Object> rpcJSON = new HashMap<>();
  ArrayList paramList = new ArrayList();
  map.put("rpcCall", rpcJSON);
  rpcJSON.put("queuetimems", getRPCQueueTime());
  rpcJSON.put("starttimems", getRPCStartTime());
  rpcJSON.put("clientaddress", clientAddress);
  rpcJSON.put("remoteport", remotePort);
  rpcJSON.put("packetlength", getRPCPacketLength());
  rpcJSON.put("method", methodName);
  rpcJSON.put("params", paramList);
  for(Object param : params) {
    if(param instanceof byte []) {
      paramList.add(Bytes.toStringBinary((byte []) param));
    } else if (param instanceof Operation) {
      paramList.add(((Operation) param).toMap());
    } else {
      paramList.add(param.toString());
    }
  }
  return map;
}
 
开发者ID:apache,项目名称:hbase,代码行数:29,代码来源:MonitoredRPCHandlerImpl.java

示例6: logResponse

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
/**
 * Logs an RPC response to the LOG file, producing valid JSON objects for
 * client Operations.
 * @param params The parameters received in the call.
 * @param methodName The name of the method invoked
 * @param call The string representation of the call
 * @param tag  The tag that will be used to indicate this event in the log.
 * @param clientAddress   The address of the client who made this call.
 * @param startTime       The time that the call was initiated, in ms.
 * @param processingTime  The duration that the call took to run, in ms.
 * @param qTime           The duration that the call spent on the queue
 *                        prior to being initiated, in ms.
 * @param responseSize    The size in bytes of the response buffer.
 */
void logResponse(Object[] params, String methodName, String call, String tag,
    String clientAddress, long startTime, int processingTime, int qTime,
    long responseSize)
        throws IOException {
  // base information that is reported regardless of type of call
  Map<String, Object> responseInfo = new HashMap<String, Object>();
  responseInfo.put("starttimems", startTime);
  responseInfo.put("processingtimems", processingTime);
  responseInfo.put("queuetimems", qTime);
  responseInfo.put("responsesize", responseSize);
  responseInfo.put("client", clientAddress);
  responseInfo.put("class", server == null? "": server.getClass().getSimpleName());
  responseInfo.put("method", methodName);
  if (params.length == 2 && server instanceof HRegionServer &&
      params[0] instanceof byte[] &&
      params[1] instanceof Operation) {
    // if the slow process is a query, we want to log its table as well
    // as its own fingerprint
    TableName tableName = TableName.valueOf(
        HRegionInfo.parseRegionName((byte[]) params[0])[0]);
    responseInfo.put("table", tableName.getNameAsString());
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[1]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
             MAPPER.writeValueAsString(responseInfo));
  } else if (params.length == 1 && server instanceof HRegionServer &&
      params[0] instanceof Operation) {
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[0]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
             MAPPER.writeValueAsString(responseInfo));
  } else {
    // can't get JSON details, so just report call.toString() along with
    // a more generic tag.
    responseInfo.put("call", call);
    LOG.warn("(response" + tag + "): " + MAPPER.writeValueAsString(responseInfo));
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:55,代码来源:RpcServer.java

示例7: logResponse

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
/**
 * Logs an RPC response to the LOG file, producing valid JSON objects for
 * client Operations.
 * @param call The call to log.
 * @param tag  The tag that will be used to indicate this event in the log.
 * @param clientAddress   The address of the client who made this call.
 * @param startTime       The time that the call was initiated, in ms.
 * @param processingTime  The duration that the call took to run, in ms.
 * @param qTime           The duration that the call spent on the queue 
 *                        prior to being initiated, in ms.
 * @param responseSize    The size in bytes of the response buffer.
 */
private void logResponse(Invocation call, String tag, String clientAddress,
    long startTime, int processingTime, int qTime, long responseSize)
  throws IOException {
  Object params[] = call.getParameters();
  // for JSON encoding
  ObjectMapper mapper = new ObjectMapper();
  // base information that is reported regardless of type of call
  Map<String, Object> responseInfo = new HashMap<String, Object>();
  responseInfo.put("starttimems", startTime);
  responseInfo.put("processingtimems", processingTime);
  responseInfo.put("queuetimems", qTime);
  responseInfo.put("responsesize", responseSize);
  responseInfo.put("client", clientAddress);
  responseInfo.put("class", instance.getClass().getSimpleName());
  responseInfo.put("method", call.getMethodName());
  if (params.length == 2 && instance instanceof HRegionServer &&
      params[0] instanceof byte[] &&
      params[1] instanceof Operation) {
    // if the slow process is a query, we want to log its table as well 
    // as its own fingerprint
    byte [] tableName =
      HRegionInfo.parseRegionName((byte[]) params[0])[0];
    responseInfo.put("table", Bytes.toStringBinary(tableName));
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[1]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
        mapper.writeValueAsString(responseInfo));
  } else if (params.length == 1 && instance instanceof HRegionServer &&
      params[0] instanceof Operation) {
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[0]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
        mapper.writeValueAsString(responseInfo));
  } else {
    // can't get JSON details, so just report call.toString() along with 
    // a more generic tag.
    responseInfo.put("call", call.toString());
    LOG.warn("(response" + tag + "): " +
        mapper.writeValueAsString(responseInfo));
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:56,代码来源:WritableRpcEngine.java

示例8: logResponse

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
/**
 * Logs an RPC response to the LOG file, producing valid JSON objects for
 * client Operations.
 * @param params The parameters received in the call.
 * @param methodName The name of the method invoked
 * @param call The string representation of the call
 * @param tag  The tag that will be used to indicate this event in the log.
 * @param clientAddress   The address of the client who made this call.
 * @param startTime       The time that the call was initiated, in ms.
 * @param processingTime  The duration that the call took to run, in ms.
 * @param qTime           The duration that the call spent on the queue
 *                        prior to being initiated, in ms.
 * @param responseSize    The size in bytes of the response buffer.
 */
void logResponse(Object[] params, String methodName, String call, String tag,
    String clientAddress, long startTime, int processingTime, int qTime,
    long responseSize)
        throws IOException {
  // base information that is reported regardless of type of call
  Map<String, Object> responseInfo = new HashMap<String, Object>();
  responseInfo.put("starttimems", startTime);
  responseInfo.put("processingtimems", processingTime);
  responseInfo.put("queuetimems", qTime);
  responseInfo.put("responsesize", responseSize);
  responseInfo.put("client", clientAddress);
  responseInfo.put("class", serverInstance == null? "": serverInstance.getClass().getSimpleName());
  responseInfo.put("method", methodName);
  if (params.length == 2 && serverInstance instanceof HRegionServer &&
      params[0] instanceof byte[] &&
      params[1] instanceof Operation) {
    // if the slow process is a query, we want to log its table as well
    // as its own fingerprint
    TableName tableName = TableName.valueOf(
        HRegionInfo.parseRegionName((byte[]) params[0])[0]);
    responseInfo.put("table", tableName.getNameAsString());
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[1]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
             MAPPER.writeValueAsString(responseInfo));
  } else if (params.length == 1 && serverInstance instanceof HRegionServer &&
      params[0] instanceof Operation) {
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[0]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
             MAPPER.writeValueAsString(responseInfo));
  } else {
    // can't get JSON details, so just report call.toString() along with
    // a more generic tag.
    responseInfo.put("call", call);
    LOG.warn("(response" + tag + "): " + MAPPER.writeValueAsString(responseInfo));
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:55,代码来源:RpcServer.java

示例9: logResponse

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
/**
 * Logs an RPC response to the LOG file, producing valid JSON objects for
 * client Operations.
 * @param call The call to log.
 * @param tag  The tag that will be used to indicate this event in the log.
 * @param client          The address of the client who made this call.
 * @param startTime       The time that the call was initiated, in ms.
 * @param processingTime  The duration that the call took to run, in ms.
 * @param qTime           The duration that the call spent on the queue 
 *                        prior to being initiated, in ms.
 * @param responseSize    The size in bytes of the response buffer.
 */
private void logResponse(Invocation call, String tag, String clientAddress,
    long startTime, int processingTime, int qTime, long responseSize)
  throws IOException {
  Object params[] = call.getParameters();
  // for JSON encoding
  ObjectMapper mapper = new ObjectMapper();
  // base information that is reported regardless of type of call
  Map<String, Object> responseInfo = new HashMap<String, Object>();
  responseInfo.put("starttimems", startTime);
  responseInfo.put("processingtimems", processingTime);
  responseInfo.put("queuetimems", qTime);
  responseInfo.put("responsesize", responseSize);
  responseInfo.put("client", clientAddress);
  responseInfo.put("class", instance.getClass().getSimpleName());
  responseInfo.put("method", call.getMethodName());
  if (params.length == 2 && instance instanceof HRegionServer &&
      params[0] instanceof byte[] &&
      params[1] instanceof Operation) {
    // if the slow process is a query, we want to log its table as well 
    // as its own fingerprint
    byte [] tableName =
      HRegionInfo.parseRegionName((byte[]) params[0])[0];
    responseInfo.put("table", Bytes.toStringBinary(tableName));
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[1]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
        mapper.writeValueAsString(responseInfo));
  } else if (params.length == 1 && instance instanceof HRegionServer &&
      params[0] instanceof Operation) {
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[0]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
        mapper.writeValueAsString(responseInfo));
  } else {
    // can't get JSON details, so just report call.toString() along with 
    // a more generic tag.
    responseInfo.put("call", call.toString());
    LOG.warn("(response" + tag + "): " +
        mapper.writeValueAsString(responseInfo));
  }
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:56,代码来源:WritableRpcEngine.java

示例10: logResponse

import org.apache.hadoop.hbase.client.Operation; //导入依赖的package包/类
/**
 * Logs an RPC response to the LOG file, producing valid JSON objects for
 * client Operations.
 * @param params The parameters received in the call.
 * @param methodName The name of the method invoked
 * @param call The string representation of the call
 * @param tag  The tag that will be used to indicate this event in the log.
 * @param clientAddress   The address of the client who made this call.
 * @param startTime       The time that the call was initiated, in ms.
 * @param processingTime  The duration that the call took to run, in ms.
 * @param qTime           The duration that the call spent on the queue
 *                        prior to being initiated, in ms.
 * @param responseSize    The size in bytes of the response buffer.
 */
void logResponse(Object[] params, String methodName, String call, String tag,
                 String clientAddress, long startTime, int processingTime, int qTime,
                 long responseSize)
    throws IOException {
  // for JSON encoding
  ObjectMapper mapper = new ObjectMapper();
  // base information that is reported regardless of type of call
  Map<String, Object> responseInfo = new HashMap<String, Object>();
  responseInfo.put("starttimems", startTime);
  responseInfo.put("processingtimems", processingTime);
  responseInfo.put("queuetimems", qTime);
  responseInfo.put("responsesize", responseSize);
  responseInfo.put("client", clientAddress);
  responseInfo.put("class", instance.getClass().getSimpleName());
  responseInfo.put("method", methodName);
  if (params.length == 2 && instance instanceof HRegionServer &&
      params[0] instanceof byte[] &&
      params[1] instanceof Operation) {
    // if the slow process is a query, we want to log its table as well
    // as its own fingerprint
    byte [] tableName =
        HRegionInfo.parseRegionName((byte[]) params[0])[0];
    responseInfo.put("table", Bytes.toStringBinary(tableName));
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[1]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
        mapper.writeValueAsString(responseInfo));
  } else if (params.length == 1 && instance instanceof HRegionServer &&
      params[0] instanceof Operation) {
    // annotate the response map with operation details
    responseInfo.putAll(((Operation) params[0]).toMap());
    // report to the log file
    LOG.warn("(operation" + tag + "): " +
        mapper.writeValueAsString(responseInfo));
  } else {
    // can't get JSON details, so just report call.toString() along with
    // a more generic tag.
    responseInfo.put("call", call);
    LOG.warn("(response" + tag + "): " +
        mapper.writeValueAsString(responseInfo));
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:58,代码来源:ProtobufRpcServerEngine.java


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