diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-10-01 22:26:23 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-10-01 22:26:23 +0200 |
commit | 34c3d369bb9365d368fff4c9cf8022655ebf229a (patch) | |
tree | 1a1cd10a8b33cf912cae0a05a23ccccc75061b5a /jdisc_core/src/main/java/com/yahoo/jdisc | |
parent | 81286072eea21017cc4f24046bdcbe531c2f55b8 (diff) |
- Add deprecation warning for methods only used in tests to enable using final on members.
- assign the reference at the end of the constructor to avoid possibility for exceptions thrown leaving the reference hidden in the dark.
- Catch Throwable instead of RuntimException to avoid some exceptions to pass.
Diffstat (limited to 'jdisc_core/src/main/java/com/yahoo/jdisc')
-rw-r--r-- | jdisc_core/src/main/java/com/yahoo/jdisc/Request.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java b/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java index 895ddb30a6d..c1431ff8ba8 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java @@ -45,9 +45,9 @@ public class Request extends AbstractResource { private volatile boolean cancel = false; private BindingMatch<RequestHandler> bindingMatch; private TimeoutManager timeoutManager; - private boolean serverRequest; + private boolean serverRequest; // TODO could be final, only used in tests private Long timeout; - private URI uri; + private URI uri; // TODO Could be made final, public enum RequestType { READ, WRITE, MONITORING @@ -79,12 +79,12 @@ public class Request extends AbstractResource { * @param uri The identifier of this request. */ public Request(CurrentContainer current, URI uri) { - container = current.newReference(uri); parent = null; parentReference = null; - creationTime = container.currentTimeMillis(); serverRequest = true; setUri(uri); + container = current.newReference(uri); + creationTime = container.currentTimeMillis(); } /** @@ -113,11 +113,11 @@ public class Request extends AbstractResource { */ public Request(Request parent, URI uri) { this.parent = parent; - this.parentReference = this.parent.refer(); container = null; creationTime = parent.container().currentTimeMillis(); serverRequest = false; setUri(uri); + parentReference = this.parent.refer(); } /** Returns the {@link Container} for which this Request was created */ @@ -142,6 +142,7 @@ public class Request extends AbstractResource { * @return this, to allow chaining * @see #getUri() */ + @Deprecated public Request setUri(URI uri) { this.uri = uri.normalize(); return this; @@ -166,6 +167,7 @@ public class Request extends AbstractResource { * @return this, to allow chaining * @see #isServerRequest() */ + @Deprecated public Request setServerRequest(boolean serverRequest) { this.serverRequest = serverRequest; return this; |