@Test public void testWaitUntilStartTimeThrowsNullPointerException() throws Throwable { DailyTaskAdaptor dailyTaskAdaptor = new DailyTaskAdaptor(); try { dailyTaskAdaptor.waitUntilStartTime(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.core.Configuration.get(String)\" because \"this.cfg\" is null", ex.getMessage(), "ex.getMessage()"); } assertNull(dailyTaskAdaptor.getConfiguration(), "dailyTaskAdaptor.getConfiguration()"); } }
protected void waitUntilStartTime() { Date when = getWhen(); while (running()) { Date now = new GregorianCalendar().getTime(); if (now.before (when)) { long sleepTime = when.getTime() - now.getTime(); if (sleepTime <= 0) { ISOUtil.sleep(1000); continue; } getLog().info ("sleeping", sleepTime/1000 + " secs until " + when.toString() ); try { Thread.sleep (sleepTime); } catch (InterruptedException e) { when = getWhen(); } } else break; } }
DailyTaskAdaptor extends QBeanSupport implements Runnable { protected void waitUntilStartTime() { Date when = getWhen(); while (running()) { Date now = new GregorianCalendar().getTime(); if (now.before (when)) { long sleepTime = when.getTime() - now.getTime(); if (sleepTime <= 0) { ISOUtil.sleep(1000); continue; } getLog().info ("sleeping", sleepTime/1000 + " secs until " + when.toString() ); try { Thread.sleep (sleepTime); } catch (InterruptedException e) { when = getWhen(); } } else break; } } }
DailyTaskAdaptor extends QBeanSupport implements Runnable { protected void waitUntilStartTime() { Date when = getWhen(); while (running()) { Date now = new GregorianCalendar().getTime(); if (now.before (when)) { long sleepTime = when.getTime() - now.getTime(); if (sleepTime <= 0) { ISOUtil.sleep(1000); continue; } getLog().info ("sleeping", sleepTime/1000 + " secs until " + when.toString() ); try { Thread.sleep (sleepTime); } catch (InterruptedException e) { when = getWhen(); } } else break; } } DailyTaskAdaptor(); }
DailyTaskAdaptor extends QBeanSupport implements Runnable { protected void waitUntilStartTime() { Date when = getWhen(); while (running()) { Date now = new GregorianCalendar().getTime(); if (now.before (when)) { long sleepTime = when.getTime() - now.getTime(); if (sleepTime <= 0) { ISOUtil.sleep(1000); continue; } getLog().info ("sleeping", sleepTime/1000 + " secs until " + when.toString() ); try { Thread.sleep (sleepTime); } catch (InterruptedException e) { when = getWhen(); } } else break; } } DailyTaskAdaptor(); void run(); Date getWhen(); }
DailyTaskAdaptor extends QBeanSupport implements Runnable { protected void waitUntilStartTime() { Date when = getWhen(); while (running()) { Date now = new GregorianCalendar().getTime(); if (now.before (when)) { long sleepTime = when.getTime() - now.getTime(); if (sleepTime <= 0) { ISOUtil.sleep(1000); continue; } getLog().info ("sleeping", sleepTime/1000 + " secs until " + when.toString() ); try { Thread.sleep (sleepTime); } catch (InterruptedException e) { when = getWhen(); } } else break; } } DailyTaskAdaptor(); void run(); Date getWhen();  }