/** * Sleep. */ public static void sleep() { sleep(timeInMillis); }
/** * Sleep. */ public static void sleep() { sleep(TIME_IN_MILLIS); }
switch (unit) { case NANOSECONDS: sleep(0L, time); break; case MICROSECONDS: sleep(0L, time * 1000); break; case MILLISECONDS: sleep(time); break; case SECONDS: sleep(time * 1000L); break; case MINUTES: sleep(time * 1000L * 60); break; case HOURS: sleep(time * 1000L * 60 * 60); break; case DAYS: sleep(time * 1000L * 60 * 60 * 24); break; default: log.warn("unknown TimeUnit " + unit + " interpreting it as WEEKS"); sleep(time * 1000L * 60 * 60 * 24 * 7); break;
switch (unit) { case NANOSECONDS: sleep(0L, time); break; case MICROSECONDS: sleep(0L, time * 1000); break; case MILLISECONDS: sleep(time); break; case SECONDS: sleep(time * 1000L); break; case MINUTES: sleep(time * 1000L * 60); break; case HOURS: sleep(time * 1000L * 60 * 60); break; case DAYS: sleep(time * 1000L * 60 * 60 * 24); break; default: LOG.warn("unknown TimeUnit " + unit + " interpreting it as WEEKS"); sleep(time * 1000L * 60 * 60 * 24 * 7); break;
/** * This main method is only for testing the ClasspathMonitor together with * the 'jconsole'. On a Java5 VM start it with the following options: * -Dcom.sun.management.jmxremote.local.only=false * -Dcom.sun.management.jmxremote * * @param args the args * * @throws JMException the JM exception */ public static void main(String[] args) throws JMException { ClasspathMonitor.registerAsMBean(); ThreadUtil.sleep(300, TimeUnit.SECONDS); }
/** * This main method is only for testing the ClasspathMonitor together with * the 'jconsole'. On a Java5 VM start it with the following options: * -Dcom.sun.management.jmxremote.local.only=false * -Dcom.sun.management.jmxremote * * @param args * the args * @throws JMException * the JM exception */ public static void main(final String[] args) throws JMException { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = new ObjectName("patterntesting.runtime.monitor:type=ClasspathMonitor"); ClasspathMonitor hello = new ClasspathMonitor(); Object mbean = new AnnotatedStandardMBean(hello, ClasspathMonitorMBean.class); mbs.registerMBean(mbean, name); ThreadUtil.sleep(300, TimeUnit.SECONDS); }