本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
}
示例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));
}
}
示例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));
}
}
示例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));
}
}
示例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));
}
}