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