src/share/classes/sun/management/snmp/jvminstr/JvmThreadingImpl.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net


 286 
 287             // The value is valid, but is the feature supported ?
 288             ThreadMXBean mbean = getThreadMXBean();
 289             if(mbean.isThreadContentionMonitoringSupported()) return;
 290 
 291             log.debug("checkJvmThreadContentionMonitoring",
 292                       "Unsupported operation, can't set state");
 293             throw new
 294                 SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue);
 295         }
 296 
 297         log.debug("checkJvmThreadContentionMonitoring",
 298                   "Try to set to unknown value");
 299         throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
 300     }
 301 
 302     /**
 303      * Getter for the "JvmThreadTotalStartedCount" variable.
 304      */
 305     public Long getJvmThreadTotalStartedCount() throws SnmpStatusException {
 306         return new Long(getThreadMXBean().getTotalStartedThreadCount());
 307     }
 308 
 309     /**
 310      * Getter for the "JvmThreadPeakCount" variable.
 311      */
 312     public Long getJvmThreadPeakCount() throws SnmpStatusException {
 313         return  new Long(getThreadMXBean().getPeakThreadCount());
 314     }
 315 
 316     /**
 317      * Getter for the "JvmThreadDaemonCount" variable.
 318      */
 319     public Long getJvmThreadDaemonCount() throws SnmpStatusException {
 320         return new Long(getThreadMXBean().getDaemonThreadCount());
 321     }
 322 
 323     /**
 324      * Getter for the "JvmThreadCount" variable.
 325      */
 326     public Long getJvmThreadCount() throws SnmpStatusException {
 327         return new Long(getThreadMXBean().getThreadCount());
 328     }
 329 
 330    /**
 331      * Getter for the "JvmThreadPeakCountReset" variable.
 332      */
 333     public synchronized Long getJvmThreadPeakCountReset()
 334         throws SnmpStatusException {
 335         return new Long(jvmThreadPeakCountReset);
 336     }
 337 
 338     /**
 339      * Setter for the "JvmThreadPeakCountReset" variable.
 340      */
 341     public synchronized void setJvmThreadPeakCountReset(Long x)
 342         throws SnmpStatusException {
 343         final long l = x.longValue();
 344         if (l > jvmThreadPeakCountReset) {
 345             final long stamp = System.currentTimeMillis();
 346             getThreadMXBean().resetPeakThreadCount();
 347             jvmThreadPeakCountReset = stamp;
 348             log.debug("setJvmThreadPeakCountReset",
 349                       "jvmThreadPeakCountReset="+stamp);
 350         }
 351     }
 352 
 353     /**
 354      * Checker for the "JvmThreadPeakCountReset" variable.
 355      */


 286 
 287             // The value is valid, but is the feature supported ?
 288             ThreadMXBean mbean = getThreadMXBean();
 289             if(mbean.isThreadContentionMonitoringSupported()) return;
 290 
 291             log.debug("checkJvmThreadContentionMonitoring",
 292                       "Unsupported operation, can't set state");
 293             throw new
 294                 SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue);
 295         }
 296 
 297         log.debug("checkJvmThreadContentionMonitoring",
 298                   "Try to set to unknown value");
 299         throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
 300     }
 301 
 302     /**
 303      * Getter for the "JvmThreadTotalStartedCount" variable.
 304      */
 305     public Long getJvmThreadTotalStartedCount() throws SnmpStatusException {
 306         return getThreadMXBean().getTotalStartedThreadCount();
 307     }
 308 
 309     /**
 310      * Getter for the "JvmThreadPeakCount" variable.
 311      */
 312     public Long getJvmThreadPeakCount() throws SnmpStatusException {
 313         return  (long)getThreadMXBean().getPeakThreadCount();
 314     }
 315 
 316     /**
 317      * Getter for the "JvmThreadDaemonCount" variable.
 318      */
 319     public Long getJvmThreadDaemonCount() throws SnmpStatusException {
 320         return (long)getThreadMXBean().getDaemonThreadCount();
 321     }
 322 
 323     /**
 324      * Getter for the "JvmThreadCount" variable.
 325      */
 326     public Long getJvmThreadCount() throws SnmpStatusException {
 327         return (long)getThreadMXBean().getThreadCount();
 328     }
 329 
 330    /**
 331      * Getter for the "JvmThreadPeakCountReset" variable.
 332      */
 333     public synchronized Long getJvmThreadPeakCountReset()
 334         throws SnmpStatusException {
 335         return jvmThreadPeakCountReset;
 336     }
 337 
 338     /**
 339      * Setter for the "JvmThreadPeakCountReset" variable.
 340      */
 341     public synchronized void setJvmThreadPeakCountReset(Long x)
 342         throws SnmpStatusException {
 343         final long l = x.longValue();
 344         if (l > jvmThreadPeakCountReset) {
 345             final long stamp = System.currentTimeMillis();
 346             getThreadMXBean().resetPeakThreadCount();
 347             jvmThreadPeakCountReset = stamp;
 348             log.debug("setJvmThreadPeakCountReset",
 349                       "jvmThreadPeakCountReset="+stamp);
 350         }
 351     }
 352 
 353     /**
 354      * Checker for the "JvmThreadPeakCountReset" variable.
 355      */