001/* 002 * 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019 020package org.apache.hadoop.hbase.namequeues; 021 022import org.apache.commons.lang3.builder.ToStringBuilder; 023import org.apache.hadoop.hbase.ipc.RpcCall; 024import org.apache.hbase.thirdparty.com.google.protobuf.Message; 025import org.apache.yetus.audience.InterfaceAudience; 026 027/** 028 * RpcCall details that would be passed on to ring buffer of slow log responses 029 */ 030@InterfaceAudience.Private 031public class RpcLogDetails extends NamedQueuePayload { 032 033 public static final int SLOW_LOG_EVENT = 0; 034 035 private final RpcCall rpcCall; 036 private final Message param; 037 private final String clientAddress; 038 private final long responseSize; 039 private final String className; 040 private final boolean isSlowLog; 041 private final boolean isLargeLog; 042 043 public RpcLogDetails(RpcCall rpcCall, Message param, String clientAddress, long responseSize, 044 String className, boolean isSlowLog, boolean isLargeLog) { 045 super(SLOW_LOG_EVENT); 046 this.rpcCall = rpcCall; 047 this.param = param; 048 this.clientAddress = clientAddress; 049 this.responseSize = responseSize; 050 this.className = className; 051 this.isSlowLog = isSlowLog; 052 this.isLargeLog = isLargeLog; 053 } 054 055 public RpcCall getRpcCall() { 056 return rpcCall; 057 } 058 059 public String getClientAddress() { 060 return clientAddress; 061 } 062 063 public long getResponseSize() { 064 return responseSize; 065 } 066 067 public String getClassName() { 068 return className; 069 } 070 071 public boolean isSlowLog() { 072 return isSlowLog; 073 } 074 075 public boolean isLargeLog() { 076 return isLargeLog; 077 } 078 079 public Message getParam() { 080 return param; 081 } 082 083 @Override 084 public String toString() { 085 return new ToStringBuilder(this) 086 .append("rpcCall", rpcCall) 087 .append("param", param) 088 .append("clientAddress", clientAddress) 089 .append("responseSize", responseSize) 090 .append("className", className) 091 .append("isSlowLog", isSlowLog) 092 .append("isLargeLog", isLargeLog) 093 .toString(); 094 } 095}