Description
This issue addresses the following three improvements.
1. `seconds` variable needs to be multiplied by 1000.
- public void sleep() throws Exception { - java.lang.Thread.sleep(seconds); + public void sleep() throws InterruptedException { + java.lang.Thread.sleep(seconds * 1000);
2. Use more specific exception
In our website and codes, Tang examples use a mixed use of both InterruptedException and Exception for java.lang.Thread.sleep().
InterruptedException
- Timer.java
- TimerV1.java
Exception
- TimerImpl.java
- TimerMock.java
- tang.md (and also http://reef.incubator.apache.org/tang.html)
Since it's our website example, it would be better if we use more specific exception type like the following.
- public static void main(final String[] args) throws BindException, InjectionException, Exception { + public static void main(final String[] args) throws BindException, InjectionException, InterruptedException {
3. Clean up redundant modifiers in Interface.
public interface Timer { @NamedParameter(default_value="10", doc="Number of seconds to sleep", short_name="sec") - public static class Seconds implements Name<Integer> { } - public void sleep() throws Exception; + class Seconds implements Name<Integer> { } + void sleep() throws InterruptedException; }
Attachments
Issue Links
- links to