You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by "Mariia Mykhailova (JIRA)" <ji...@apache.org> on 2015/10/20 23:37:27 UTC

[jira] [Resolved] (REEF-855) Improve Tang examples

     [ https://issues.apache.org/jira/browse/REEF-855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mariia Mykhailova resolved REEF-855.
------------------------------------
       Resolution: Fixed
    Fix Version/s: 0.14

Resolved via [PR 575|https://github.com/apache/incubator-reef/pull/575]

> Improve Tang examples
> ---------------------
>
>                 Key: REEF-855
>                 URL: https://issues.apache.org/jira/browse/REEF-855
>             Project: REEF
>          Issue Type: Bug
>          Components: Tang
>    Affects Versions: 0.13
>            Reporter: Dongjoon Hyun
>            Assignee: Dongjoon Hyun
>            Priority: Trivial
>             Fix For: 0.14
>
>
> This issue addresses the following three improvements.
> *1. `seconds` variable needs to be multiplied by 1000.*
> {code}
> -  public void sleep() throws Exception {
> -    java.lang.Thread.sleep(seconds);
> +  public void sleep() throws InterruptedException {
> +    java.lang.Thread.sleep(seconds * 1000);
> {code}
> *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.
> {code}
> - public static void main(final String[] args) throws BindException, InjectionException, Exception {
> + public static void main(final String[] args) throws BindException, InjectionException, InterruptedException {
> {code}
> *3. Clean up redundant modifiers in Interface.*
> {code}
> 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;
>  }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)