Uploaded image for project: 'REEF (Retired)'
  1. REEF (Retired)
  2. REEF-855

Improve Tang examples

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 0.13
    • 0.14
    • Tang
    • None

    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

      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

          Activity

            People

              dongjoon Dongjoon Hyun
              dongjoon Dongjoon Hyun
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: