src/java.management/share/classes/java/lang/management/MemoryUsage.java

Print this page
rev 10537 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 220      * used for memory management.  This method returns <tt>-1</tt>
 221      * if the maximum memory size is undefined.
 222      *
 223      * <p> This amount of memory is not guaranteed to be available
 224      * for memory management if it is greater than the amount of
 225      * committed memory.  The Java virtual machine may fail to allocate
 226      * memory even if the amount of used memory does not exceed this
 227      * maximum size.
 228      *
 229      * @return the maximum amount of memory in bytes;
 230      * <tt>-1</tt> if undefined.
 231      */
 232     public long getMax() {
 233         return max;
 234     };
 235 
 236     /**
 237      * Returns a descriptive representation of this memory usage.
 238      */
 239     public String toString() {
 240         StringBuilder buf = new StringBuilder();
 241         buf.append("init = " + init + "(" + (init >> 10) + "K) ");
 242         buf.append("used = " + used + "(" + (used >> 10) + "K) ");
 243         buf.append("committed = " + committed + "(" +
 244                    (committed >> 10) + "K) " );
 245         buf.append("max = " + max + "(" + (max >> 10) + "K)");
 246         return buf.toString();



 247     }
 248 
 249     /**
 250      * Returns a <tt>MemoryUsage</tt> object represented by the
 251      * given <tt>CompositeData</tt>. The given <tt>CompositeData</tt>
 252      * must contain the following attributes:
 253      *
 254      * <blockquote>
 255      * <table border summary="The attributes and the types the given CompositeData contains">
 256      * <tr>
 257      *   <th align=left>Attribute Name</th>
 258      *   <th align=left>Type</th>
 259      * </tr>
 260      * <tr>
 261      *   <td>init</td>
 262      *   <td><tt>java.lang.Long</tt></td>
 263      * </tr>
 264      * <tr>
 265      *   <td>used</td>
 266      *   <td><tt>java.lang.Long</tt></td>




 220      * used for memory management.  This method returns <tt>-1</tt>
 221      * if the maximum memory size is undefined.
 222      *
 223      * <p> This amount of memory is not guaranteed to be available
 224      * for memory management if it is greater than the amount of
 225      * committed memory.  The Java virtual machine may fail to allocate
 226      * memory even if the amount of used memory does not exceed this
 227      * maximum size.
 228      *
 229      * @return the maximum amount of memory in bytes;
 230      * <tt>-1</tt> if undefined.
 231      */
 232     public long getMax() {
 233         return max;
 234     };
 235 
 236     /**
 237      * Returns a descriptive representation of this memory usage.
 238      */
 239     public String toString() {
 240         StringBuilder sb = new StringBuilder();
 241         sb.append("init = ").append(init).append('(').append(init >> 10)
 242                 .append("K) ");
 243         sb.append("used = ").append(used).append('(').append(used >> 10)
 244                 .append("K) ");
 245         sb.append("committed = ").append(committed).append('(')
 246                 .append(committed >> 10).append("K) ");
 247         sb.append("max = ").append(max).append('(').append(max >> 10)
 248                 .append("K)");
 249         return sb.toString();
 250     }
 251 
 252     /**
 253      * Returns a <tt>MemoryUsage</tt> object represented by the
 254      * given <tt>CompositeData</tt>. The given <tt>CompositeData</tt>
 255      * must contain the following attributes:
 256      *
 257      * <blockquote>
 258      * <table border summary="The attributes and the types the given CompositeData contains">
 259      * <tr>
 260      *   <th align=left>Attribute Name</th>
 261      *   <th align=left>Type</th>
 262      * </tr>
 263      * <tr>
 264      *   <td>init</td>
 265      *   <td><tt>java.lang.Long</tt></td>
 266      * </tr>
 267      * <tr>
 268      *   <td>used</td>
 269      *   <td><tt>java.lang.Long</tt></td>