summaryrefslogtreecommitdiffstats
path: root/jdisc_core
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-06-07 11:24:16 +0200
committergjoranv <gv@verizonmedia.com>2022-06-08 11:45:30 +0200
commit53506a56d8eda1063e2fa95edb40b87efb3161ea (patch)
treec85dfcc2cc36b997d82d485ffeb946668ca43698 /jdisc_core
parentb4225acc7f9cc67ad8b284ff950684f7efa40b08 (diff)
GC deprecated methods and make mebers final.
Diffstat (limited to 'jdisc_core')
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/Request.java39
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java9
2 files changed, 4 insertions, 44 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 c94ac5d9c60..c219ae06846 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java
@@ -42,12 +42,12 @@ public class Request extends AbstractResource {
private final Request parent;
private final ResourceReference parentReference;
private final long creationTime;
+ private final boolean serverRequest;
+ private final URI uri;
private volatile boolean cancel = false;
private BindingMatch<RequestHandler> bindingMatch;
private TimeoutManager timeoutManager;
- private boolean serverRequest; // TODO could be final, only used in tests
private Long timeout;
- private URI uri; // TODO Could be made final,
public enum RequestType {
READ, WRITE, MONITORING
@@ -86,7 +86,7 @@ public class Request extends AbstractResource {
parent = null;
parentReference = null;
serverRequest = isServerRequest;
- setUri(uri);
+ this.uri = uri.normalize();
container = current.newReference(uri, this);
creationTime = container.currentTimeMillis();
}
@@ -120,7 +120,7 @@ public class Request extends AbstractResource {
container = null;
creationTime = parent.container().currentTimeMillis();
serverRequest = false;
- setUri(uri);
+ this.uri = uri.normalize();
parentReference = this.parent.refer(this);
}
@@ -132,27 +132,10 @@ public class Request extends AbstractResource {
/**
* Returns the Uniform Resource Identifier used by the {@link Container} to resolve the appropriate {@link
* RequestHandler} for this Request.
- *
- * @see #setUri(URI)
*/
public URI getUri() { return uri; }
/**
- * Sets the Uniform Resource Identifier used by the {@link Container} to resolve the appropriate {@link
- * RequestHandler} for this Request. Because access to the URI is not guarded by any lock, any changes made after
- * calling {@link #connect(ResponseHandler)} might never become visible to other threads.
- *
- * @param uri the URI to set
- * @return this, to allow chaining
- * @see #getUri()
- */
- @Deprecated
- public Request setUri(URI uri) {
- this.uri = uri.normalize();
- return this;
- }
-
- /**
* Returns whether or not this Request was created by a {@link ServerProvider}. The value of this is used by
* {@link Container#resolveHandler(Request)} to decide whether to match against server- or client-bindings.
*
@@ -162,20 +145,6 @@ public class Request extends AbstractResource {
return serverRequest;
}
- /**
- * Sets whether or not this Request was created by a {@link ServerProvider}. The constructor that accepts a
- * {@link CurrentContainer} sets this to <em>true</em>, whereas the constructor that accepts a parent Request sets
- * this to <em>false</em>.
- *
- * @param serverRequest whether or not this is a server request
- * @return this, to allow chaining
- * @see #isServerRequest()
- */
- @Deprecated
- public Request setServerRequest(boolean serverRequest) {
- this.serverRequest = serverRequest;
- return this;
- }
/**
* Returns the last resolved {@link BindingMatch}, or null if none has been resolved yet. This is set
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java
index 75154dd588e..0d665e297da 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/RequestTestCase.java
@@ -33,7 +33,6 @@ import static org.junit.Assert.fail;
public class RequestTestCase {
@Test
- @SuppressWarnings("deprecation")
public void requireThatAccessorsWork() throws BindingSetNotFoundException {
MyTimer timer = new MyTimer();
timer.currentTime = 69;
@@ -43,11 +42,7 @@ public class RequestTestCase {
Request request = new Request(driver, URI.create("http://foo/bar"));
assertNotNull(request);
assertEquals(URI.create("http://foo/bar"), request.getUri());
- request.setUri(URI.create("http://baz/cox"));
- assertEquals(URI.create("http://baz/cox"), request.getUri());
assertTrue(request.isServerRequest());
- request.setServerRequest(false);
- assertFalse(request.isServerRequest());
assertEquals(69, request.creationTime(TimeUnit.MILLISECONDS));
assertNull(request.getTimeout(TimeUnit.MILLISECONDS));
request.setTimeout(10, TimeUnit.MILLISECONDS);
@@ -249,14 +244,10 @@ public class RequestTestCase {
assertTrue(driver.close());
}
- @SuppressWarnings("deprecation")
private static void assertUri(CurrentContainer container, String requestUri, String expectedUri) {
Request serverReq = new Request(container, URI.create(requestUri));
assertEquals(expectedUri, serverReq.getUri().toString());
- serverReq.setUri(URI.create(requestUri));
- assertEquals(expectedUri, serverReq.getUri().toString());
-
Request clientReq = new Request(serverReq, URI.create(requestUri));
assertEquals(expectedUri, clientReq.getUri().toString());