admin@glassfish.java.net

Re: CODE REVIEW: addition toString() for internal StatisticImpl classes

From: kedar <Kedar.Mhaswade_at_Sun.COM>
Date: Fri, 13 Apr 2007 11:16:30 -0700

Sure, go ahead.

BTW, this is not a defect.

Lloyd L Chambers wrote:
> No risk on this one.
> TIMEOUT: 3pm Friday 4/13/07
>
>
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=2829
>
> MB2:/gf/build/glassfish/admin-core/monitor lloyd$ cvs diff -w -u
>
>
> Index:
> src/java/com/sun/enterprise/admin/monitor/stats/BoundedRangeStatisticImpl.java
>
> ===================================================================
> RCS file:
> /cvs/glassfish/admin-core/monitor/src/java/com/sun/enterprise/admin/monitor/stats/BoundedRangeStatisticImpl.java,v
>
> retrieving revision 1.2
> diff -w -u -r1.2 BoundedRangeStatisticImpl.java
> ---
> src/java/com/sun/enterprise/admin/monitor/stats/BoundedRangeStatisticImpl.java
> 25 Dec 2005 03:52:10 -0000 1.2
> +++
> src/java/com/sun/enterprise/admin/monitor/stats/BoundedRangeStatisticImpl.java
> 13 Apr 2007 17:00:40 -0000
> @@ -56,6 +56,16 @@
> private static final StringManager localStrMgr =
>
> StringManager.getManager(BoundedRangeStatisticImpl.class);
>
> + public String toString() {
> + return super.toString() + NEWLINE +
> + "Current: " + getCurrent() + NEWLINE +
> + "LowWaterMark: " + getLowWaterMark() + NEWLINE +
> + "HighWaterMark: " + getHighWaterMark() + NEWLINE +
> + "LowerBound: " + getLowerBound() + NEWLINE +
> + "UpperBound: " + getUpperBound();
> + }
> +
> +
> /** DEFAULT_UPPER_BOUND is maximum value Long can attain */
> public static final long DEFAULT_MAX_BOUND =
> java.lang.Long.MAX_VALUE;
> /** DEFAULT_LOWER_BOUND is same as DEFAULT_VALUE i.e. 0 */
> Index:
> src/java/com/sun/enterprise/admin/monitor/stats/CountStatisticImpl.java
> ===================================================================
> RCS file:
> /cvs/glassfish/admin-core/monitor/src/java/com/sun/enterprise/admin/monitor/stats/CountStatisticImpl.java,v
>
> retrieving revision 1.2
> diff -w -u -r1.2 CountStatisticImpl.java
> ---
> src/java/com/sun/enterprise/admin/monitor/stats/CountStatisticImpl.java
> 25 Dec 2005 03:52:12 -0000 1.2
> +++
> src/java/com/sun/enterprise/admin/monitor/stats/CountStatisticImpl.java
> 13 Apr 2007 17:00:41 -0000
> @@ -122,6 +122,11 @@
> count = countVal;
> }
> + public String toString() {
> + return super.toString() + NEWLINE + "Count: " + getCount();
> + }
> +
> +
> /**
> * Returns the current value of this statistic.
> * @return long indicating current value
> Index:
> src/java/com/sun/enterprise/admin/monitor/stats/RangeStatisticImpl.java
> ===================================================================
> RCS file:
> /cvs/glassfish/admin-core/monitor/src/java/com/sun/enterprise/admin/monitor/stats/RangeStatisticImpl.java,v
>
> retrieving revision 1.2
> diff -w -u -r1.2 RangeStatisticImpl.java
> ---
> src/java/com/sun/enterprise/admin/monitor/stats/RangeStatisticImpl.java
> 25 Dec 2005 03:52:24 -0000 1.2
> +++
> src/java/com/sun/enterprise/admin/monitor/stats/RangeStatisticImpl.java
> 13 Apr 2007 17:00:41 -0000
> @@ -94,4 +94,12 @@
> public long getLowWaterMark() {
> return lowWaterMark;
> }
> +
> + public final String toString() {
> + return super.toString() + NEWLINE +
> + "Current: " + getCurrent() + NEWLINE +
> + "LowWaterMark: " + getLowWaterMark() + NEWLINE +
> + "HighWaterMark: " + getHighWaterMark();
> + }
> +
> }
> Index: src/java/com/sun/enterprise/admin/monitor/stats/StatisticImpl.java
> ===================================================================
> RCS file:
> /cvs/glassfish/admin-core/monitor/src/java/com/sun/enterprise/admin/monitor/stats/StatisticImpl.java,v
>
> retrieving revision 1.3
> diff -w -u -r1.3 StatisticImpl.java
> ---
> src/java/com/sun/enterprise/admin/monitor/stats/StatisticImpl.java 3
> Apr 2007 01:13:41 -0000 1.3
> +++
> src/java/com/sun/enterprise/admin/monitor/stats/StatisticImpl.java 13
> Apr 2007 17:00:41 -0000
> @@ -64,6 +64,7 @@
> DEFAULT_UNIT = localStrMgr.getString("count_string");
> }
> + protected static final String NEWLINE = System.getProperty(
> "line.separator" );
> /**
> * Constructor
> * @param name The name of the statistic
> @@ -123,4 +124,19 @@
> public void setDescription(final String desc) {
> this.statisticDesc = desc;
> }
> +
> + public String toString() {
> + return "Statistic " + getClass().getName() + NEWLINE +
> + "Name: " + getName() + NEWLINE +
> + "Description: " + getDescription() + NEWLINE +
> + "Unit: " + getUnit() + NEWLINE +
> + "LastSampleTime: " + getLastSampleTime() + NEWLINE +
> + "StartTime: " + getStartTime();
> + }
> }
> +
> +
> +
> +
> +
> +
> Index:
> src/java/com/sun/enterprise/admin/monitor/stats/StringStatisticImpl.java
> ===================================================================
> RCS file:
> /cvs/glassfish/admin-core/monitor/src/java/com/sun/enterprise/admin/monitor/stats/StringStatisticImpl.java,v
>
> retrieving revision 1.2
> diff -w -u -r1.2 StringStatisticImpl.java
> ---
> src/java/com/sun/enterprise/admin/monitor/stats/StringStatisticImpl.java
> 25 Dec 2005 03:52:27 -0000 1.2
> +++
> src/java/com/sun/enterprise/admin/monitor/stats/StringStatisticImpl.java
> 13 Apr 2007 17:00:41 -0000
> @@ -68,4 +68,10 @@
> public String getCurrent() {
> return strVal;
> }
> +
> + public String toString() {
> + return super.toString() + NEWLINE +
> + "Current: " + getCurrent();
> + }
> +
> }
> Index:
> src/java/com/sun/enterprise/admin/monitor/stats/TimeStatisticImpl.java
> ===================================================================
> RCS file:
> /cvs/glassfish/admin-core/monitor/src/java/com/sun/enterprise/admin/monitor/stats/TimeStatisticImpl.java,v
>
> retrieving revision 1.2
> diff -w -u -r1.2 TimeStatisticImpl.java
> ---
> src/java/com/sun/enterprise/admin/monitor/stats/TimeStatisticImpl.java
> 25 Dec 2005 03:52:28 -0000 1.2
> +++
> src/java/com/sun/enterprise/admin/monitor/stats/TimeStatisticImpl.java
> 13 Apr 2007 17:00:41 -0000
> @@ -43,7 +43,7 @@
> * @since S1AS8.0
> */
> -public class TimeStatisticImpl extends StatisticImpl implements
> TimeStatistic {
> +public final class TimeStatisticImpl extends StatisticImpl implements
> TimeStatistic {
>
> private final long count;
> private final long maxTime;
> @@ -52,6 +52,13 @@
> private static final StringManager localStrMgr =
> StringManager.getManager(TimeStatisticImpl.class);
> + public final String toString() {
> + return super.toString() + NEWLINE +
> + "Count: " + getCount() + NEWLINE +
> + "MinTime: " + getMinTime() + NEWLINE +
> + "MaxTime: " + getMaxTime() + NEWLINE +
> + "TotalTime: " + getTotalTime();
> + }
>
> public TimeStatisticImpl(String name) {
> this(name, StatisticImpl.DEFAULT_UNIT);
> cvs diff: Diffing src/java/com/sun/enterprise/admin/monito
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>