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