Skip to content

Commit 341e286

Browse files
committed
fix batch 5
1 parent 5e089c3 commit 341e286

File tree

11 files changed

+40
-35
lines changed

11 files changed

+40
-35
lines changed

src/main/generated/io/vertx/httpproxy/cache/CacheOptionsConverter.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, CacheOp
2323
obj.setMaxSize(((Number)member.getValue()).intValue());
2424
}
2525
break;
26+
case "name":
27+
if (member.getValue() instanceof String) {
28+
obj.setName((String)member.getValue());
29+
}
30+
break;
31+
case "shared":
32+
if (member.getValue() instanceof Boolean) {
33+
obj.setShared((Boolean)member.getValue());
34+
}
35+
break;
2636
}
2737
}
2838
}
@@ -33,5 +43,9 @@ static void toJson(CacheOptions obj, JsonObject json) {
3343

3444
static void toJson(CacheOptions obj, java.util.Map<String, Object> json) {
3545
json.put("maxSize", obj.getMaxSize());
46+
if (obj.getName() != null) {
47+
json.put("name", obj.getName());
48+
}
49+
json.put("shared", obj.getShared());
3650
}
3751
}

src/main/java/io/vertx/httpproxy/HttpProxy.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import io.vertx.codegen.annotations.VertxGen;
1616
import io.vertx.core.Future;
1717
import io.vertx.core.Handler;
18-
import io.vertx.core.Vertx;
1918
import io.vertx.core.http.HttpClient;
2019
import io.vertx.core.http.HttpClientRequest;
2120
import io.vertx.core.http.HttpServerRequest;

src/main/java/io/vertx/httpproxy/ProxyContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ public interface ProxyContext {
3535
boolean isWebSocket();
3636

3737
/**
38-
* Attach a payload to the context
38+
* Attach a payload to the context.
3939
*
4040
* @param name the payload name
4141
* @param value any payload value
4242
*/
4343
void set(String name, Object value);
4444

4545
/**
46-
* Get a payload attached to this context
46+
* Get a payload attached to this context.
4747
*
4848
* @param name the payload name
4949
* @param type the expected payload type

src/main/java/io/vertx/httpproxy/ProxyInterceptor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ default Future<Void> handleProxyResponse(ProxyContext context) {
3232
/**
3333
* Used to set whether to apply the interceptor to the WebSocket
3434
* handshake packet. The default value is false.
35+
*
3536
* @return the boolean value
3637
*/
3738
default boolean allowApplyToWebSocket() {

src/main/java/io/vertx/httpproxy/ProxyRequest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static ProxyRequest reverseProxy(HttpServerRequest proxiedRequest) {
101101
ProxyRequest setBody(Body body);
102102

103103
/**
104-
* Set the request authority
104+
* Set the request authority.
105105
*
106106
* <ul>
107107
* <li>for HTTP/1 the {@literal Host} header</li>
@@ -128,7 +128,7 @@ static ProxyRequest reverseProxy(HttpServerRequest proxiedRequest) {
128128
MultiMap headers();
129129

130130
/**
131-
* Put an HTTP header
131+
* Put an HTTP header.
132132
*
133133
* @param name The header name
134134
* @param value The header value
@@ -157,7 +157,7 @@ default Future<Void> proxy(HttpClientRequest request) {
157157
Future<ProxyResponse> send(HttpClientRequest request);
158158

159159
/**
160-
* Release the proxy request and its associated resources
160+
* Release the proxy request and its associated resources.
161161
*
162162
* <p> The HTTP server request is resumed, no HTTP server response is sent.
163163
*

src/main/java/io/vertx/httpproxy/cache/CacheOptions.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ public class CacheOptions {
3333
private boolean shared = DEFAULT_SHARED;
3434

3535
/**
36-
* Default constructor
36+
* Default constructor.
3737
*/
3838
public CacheOptions() {
3939
}
4040

4141
/**
42-
* Copy constructor
42+
* Copy constructor.
4343
*
4444
* @param other the options to copy
4545
*/
@@ -50,7 +50,7 @@ public CacheOptions(CacheOptions other) {
5050
}
5151

5252
/**
53-
* Constructor to create an options from JSON
53+
* Constructor to create an options from JSON.
5454
*
5555
* @param json the JSON
5656
*/
@@ -124,7 +124,7 @@ public String toString() {
124124
}
125125

126126
/**
127-
* Convert to JSON
127+
* Convert to JSON.
128128
*
129129
* @return the JSON
130130
*/

src/main/java/io/vertx/httpproxy/impl/CacheImpl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,4 @@ public Future<Void> remove(String key) {
4444
return Future.succeededFuture();
4545
}
4646

47-
@Override
48-
public Future<Void> close() {
49-
return Future.succeededFuture();
50-
}
5147
}

src/main/java/io/vertx/httpproxy/impl/ReverseProxy.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@ public Cache newCache(CacheOptions options, Vertx vertx) {
5050
if (options.getShared()) {
5151
CloseFuture closeFuture = new CloseFuture();
5252
return ((VertxInternal) vertx).createSharedResource("__vertx.shared.proxyCache", options.getName(), closeFuture, (cf_) -> {
53-
Cache cache = new CacheImpl(options);
54-
cf_.add(completion -> {
55-
cache.close().onComplete(completion);
56-
});
57-
return cache;
53+
return new CacheImpl(options);
5854
});
5955
}
6056
return new CacheImpl(options);

src/main/java/io/vertx/httpproxy/spi/cache/Cache.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package io.vertx.httpproxy.spi.cache;
22

3+
import io.vertx.codegen.annotations.Unstable;
34
import io.vertx.core.Future;
45
import io.vertx.core.dns.SrvRecord;
56

67

78
/**
89
* Cache SPI.
910
*/
11+
@Unstable
1012
public interface Cache {
1113

1214
/**
@@ -37,11 +39,4 @@ public interface Cache {
3739
* @return a succeed void future
3840
*/
3941
Future<Void> remove(String key);
40-
41-
/**
42-
* Being called when need to close the cache.
43-
*
44-
* @return a succeed void future
45-
*/
46-
Future<Void> close();
4742
}

src/test/java/io/vertx/tests/cache/spi/CacheSpiTestBase.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ public void setUp() {
3636

3737
@After
3838
public void tearDown(TestContext context) {
39-
cache.close().onComplete(context.asyncAssertSuccess(
40-
v -> vertx.close().onComplete(context.asyncAssertSuccess())
41-
));
39+
vertx.close().onComplete(context.asyncAssertSuccess());
4240
}
4341

4442
private Resource generateResource(String absoluteURI, long maxAge) {

0 commit comments

Comments
 (0)