{"action":"created","issue":{"url":"https://api.github.com/repos/yegor256/takes/issues/427","labels_url":"https://api.github.com/repos/yegor256/takes/issues/427/labels{/name}","comments_url":"https://api.github.com/repos/yegor256/takes/issues/427/comments","events_url":"https://api.github.com/repos/yegor256/takes/issues/427/events","html_url":"https://github.com/yegor256/takes/issues/427","id":114524006,"number":427,"title":"FtCLI.exit(Exit) creates an unnecessary custom Object","user":{"login":"simonjenga","id":1405237,"avatar_url":"https://avatars.githubusercontent.com/u/1405237?v=3","gravatar_id":"","url":"https://api.github.com/users/simonjenga","html_url":"https://github.com/simonjenga","followers_url":"https://api.github.com/users/simonjenga/followers","following_url":"https://api.github.com/users/simonjenga/following{/other_user}","gists_url":"https://api.github.com/users/simonjenga/gists{/gist_id}","starred_url":"https://api.github.com/users/simonjenga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonjenga/subscriptions","organizations_url":"https://api.github.com/users/simonjenga/orgs","repos_url":"https://api.github.com/users/simonjenga/repos","events_url":"https://api.github.com/users/simonjenga/events{/privacy}","received_events_url":"https://api.github.com/users/simonjenga/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-02T04:48:21Z","updated_at":"2015-11-06T11:15:09Z","closed_at":null,"body":"In the current implementation of the method ```org.takes.http.FtCLI.exit(Exit)``` , \r\nif  the line ```exit.ready() || custom.ready();``` evaluates to ```true```, we will have already incurred the additional overhead costs (computing time & resources) of creating a custom ```Object``` that was not necessary to do so in the beginning since it will never used!\r\n\r\nThe current method implementation needs to be changed to be as follows:\r\n\r\n```\r\nprivate Exit exit(final Exit exit) {\r\n\tfinal Exit toExit;\r\n\tif (exit.ready()) {\r\n\t\ttoExit = Exit.ALWAYS;\r\n\t} else {\r\n\t\tfinal long start = System.currentTimeMillis();\r\n\t\tfinal long max = this.options.lifetime();\r\n\t\ttoExit = new Exit() {\r\n\t\t\t@Override\r\n\t\t\tpublic boolean ready() {\r\n\t\t\t\treturn (System.currentTimeMillis() - start) > max;\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\treturn toExit;\r\n}\r\n```\r\n\r\nThe following ```Object``` is then added to the interface ```org.takes.http.Exit```\r\n\r\n```\r\n/**\r\n * Always exit.\r\n */\r\nfinal Exit ALWAYS = new Exit() {\r\n\t@Override\r\n\tpublic boolean ready() {\r\n\t\treturn true;\r\n\t}\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/yegor256/takes/issues/comments/154383755","html_url":"https://github.com/yegor256/takes/issues/427#issuecomment-154383755","issue_url":"https://api.github.com/repos/yegor256/takes/issues/427","id":154383755,"user":{"login":"davvd","id":6305016,"avatar_url":"https://avatars.githubusercontent.com/u/6305016?v=3","gravatar_id":"","url":"https://api.github.com/users/davvd","html_url":"https://github.com/davvd","followers_url":"https://api.github.com/users/davvd/followers","following_url":"https://api.github.com/users/davvd/following{/other_user}","gists_url":"https://api.github.com/users/davvd/gists{/gist_id}","starred_url":"https://api.github.com/users/davvd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davvd/subscriptions","organizations_url":"https://api.github.com/users/davvd/orgs","repos_url":"https://api.github.com/users/davvd/repos","events_url":"https://api.github.com/users/davvd/events{/privacy}","received_events_url":"https://api.github.com/users/davvd/received_events","type":"User","site_admin":false},"created_at":"2015-11-06T11:15:09Z","updated_at":"2015-11-06T11:15:09Z","body":"@yegor256 please do something about it, see [par.21](http://www.teamed.io/policy.html#21)"}}