001/* 002 * Copyright 2014-2020 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright 2014-2020 Ping Identity Corporation 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020/* 021 * Copyright (C) 2015-2020 Ping Identity Corporation 022 * 023 * This program is free software; you can redistribute it and/or modify 024 * it under the terms of the GNU General Public License (GPLv2 only) 025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 026 * as published by the Free Software Foundation. 027 * 028 * This program is distributed in the hope that it will be useful, 029 * but WITHOUT ANY WARRANTY; without even the implied warranty of 030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 031 * GNU General Public License for more details. 032 * 033 * You should have received a copy of the GNU General Public License 034 * along with this program; if not, see <http://www.gnu.org/licenses>. 035 */ 036package com.unboundid.ldap.sdk.unboundidds.monitors; 037 038 039 040import java.io.Serializable; 041 042import com.unboundid.ldap.sdk.OperationType; 043import com.unboundid.util.NotMutable; 044import com.unboundid.util.ThreadSafety; 045import com.unboundid.util.ThreadSafetyLevel; 046 047 048 049/** 050 * This class provides a data structure that encapsulates information about a 051 * result code included in the result code monitor entry. 052 * <BR> 053 * <BLOCKQUOTE> 054 * <B>NOTE:</B> This class, and other classes within the 055 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 056 * supported for use against Ping Identity, UnboundID, and 057 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 058 * for proprietary functionality or for external specifications that are not 059 * considered stable or mature enough to be guaranteed to work in an 060 * interoperable way with other types of LDAP servers. 061 * </BLOCKQUOTE> 062 */ 063@NotMutable() 064@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 065public final class ResultCodeInfo 066 implements Serializable 067{ 068 /** 069 * The serial version UID for this serializable class. 070 */ 071 private static final long serialVersionUID = 1223217954357101681L; 072 073 074 075 // The average response time, in milliseconds, for operations with this result 076 // code. 077 private final double averageResponseTimeMillis; 078 079 // The percent of operations of the associated type with this result code. 080 private final double percent; 081 082 // The sum of all response times, in milliseconds, for operations with this 083 // result code. 084 private final double totalResponseTimeMillis; 085 086 // The integer value for this result code. 087 private final int intValue; 088 089 // The total number of operations of the specified type with this result code. 090 private final long count; 091 092 // The operation type for which this information is maintained, or null if 093 // it applies to all types of operations. 094 private final OperationType operationType; 095 096 // The name for this result code. 097 private final String name; 098 099 100 101 /** 102 * Creates a new result code info object with the provided information. 103 * 104 * @param intValue The integer value for this result code. 105 * @param name The name for this result code. 106 * @param operationType The type of operation to which the 107 * statistics apply. This may be 108 * {@code null} if the statistics apply to 109 * all types of operations. 110 * @param count The total number of operations of the 111 * specified type with this result code. 112 * @param percent The percent of operations of the 113 * specified type with this result code. 114 * @param totalResponseTimeMillis The total response time, in 115 * milliseconds, for all operations of the 116 * specified type with this result code. 117 * @param averageResponseTimeMillis The average response time, in 118 * milliseconds, for operations of the 119 * specified type with this result code. 120 */ 121 ResultCodeInfo(final int intValue, final String name, 122 final OperationType operationType, final long count, 123 final double percent, final double totalResponseTimeMillis, 124 final double averageResponseTimeMillis) 125 { 126 this.intValue = intValue; 127 this.name = name; 128 this.operationType = operationType; 129 this.count = count; 130 this.totalResponseTimeMillis = totalResponseTimeMillis; 131 this.averageResponseTimeMillis = averageResponseTimeMillis; 132 this.percent = percent; 133 } 134 135 136 137 /** 138 * Retrieves the integer value for this result code. 139 * 140 * @return The integer value for this result code. 141 */ 142 public int intValue() 143 { 144 return intValue; 145 } 146 147 148 149 /** 150 * Retrieves the name for this result code. 151 * 152 * @return The name for this result code. 153 */ 154 public String getName() 155 { 156 return name; 157 } 158 159 160 161 /** 162 * Retrieves the type of operation with which the result code statistics are 163 * associated, if appropriate. 164 * 165 * @return The type of operation with which the result code statistics are 166 * associated, or {@code null} if the statistics apply to all types 167 * of operations. 168 */ 169 public OperationType getOperationType() 170 { 171 return operationType; 172 } 173 174 175 176 /** 177 * The total number of operations of the associated type (or of all 178 * operations if the operation type is {@code null}) with this result code. 179 * 180 * @return The total number of operations of the associated type with this 181 * result code. 182 */ 183 public long getCount() 184 { 185 return count; 186 } 187 188 189 190 /** 191 * The percent of operations of the associated type (or of all operations if 192 * the operation type is {@code null}) with this result code. 193 * 194 * @return The percent of operations of the associated type with this result 195 * code. 196 */ 197 public double getPercent() 198 { 199 return percent; 200 } 201 202 203 204 /** 205 * The sum of the response times, in milliseconds, for all operations of the 206 * associated type (or of all operations if the operation type is 207 * {@code null}) with this result code. 208 * 209 * @return The sum of the response times, in milliseconds, for all operations 210 * of the associated type with this result code. 211 */ 212 public double getTotalResponseTimeMillis() 213 { 214 return totalResponseTimeMillis; 215 } 216 217 218 219 /** 220 * The average response time, in milliseconds, for all operations of the 221 * associated type (or of all operations if the operation type is 222 * {@code null}) with this result code. 223 * 224 * @return The average response time, in milliseconds, for all operations of 225 * the associated type with this result code. 226 */ 227 public double getAverageResponseTimeMillis() 228 { 229 return averageResponseTimeMillis; 230 } 231}