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.regionserver.slowlog;
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 {
032
033  private final RpcCall rpcCall;
034  private final Message param;
035  private final String clientAddress;
036  private final long responseSize;
037  private final String className;
038  private final boolean isSlowLog;
039  private final boolean isLargeLog;
040
041  public RpcLogDetails(RpcCall rpcCall, Message param, String clientAddress, long responseSize,
042      String className, boolean isSlowLog, boolean isLargeLog) {
043    this.rpcCall = rpcCall;
044    this.param = param;
045    this.clientAddress = clientAddress;
046    this.responseSize = responseSize;
047    this.className = className;
048    this.isSlowLog = isSlowLog;
049    this.isLargeLog = isLargeLog;
050  }
051
052  public RpcCall getRpcCall() {
053    return rpcCall;
054  }
055
056  public String getClientAddress() {
057    return clientAddress;
058  }
059
060  public long getResponseSize() {
061    return responseSize;
062  }
063
064  public String getClassName() {
065    return className;
066  }
067
068  public boolean isSlowLog() {
069    return isSlowLog;
070  }
071
072  public boolean isLargeLog() {
073    return isLargeLog;
074  }
075
076  public Message getParam() {
077    return param;
078  }
079
080  @Override
081  public String toString() {
082    return new ToStringBuilder(this)
083      .append("rpcCall", rpcCall)
084      .append("param", param)
085      .append("clientAddress", clientAddress)
086      .append("responseSize", responseSize)
087      .append("className", className)
088      .append("isSlowLog", isSlowLog)
089      .append("isLargeLog", isLargeLog)
090      .toString();
091  }
092}