Skip to content

Commit

Permalink
[SCB-1139] update vertx version from 3.5.3 to 3.6.2
Browse files Browse the repository at this point in the history
1、update netty to 4.1.28 ncnative to 2.0.14.Final jackson 2.9.8
2、vertximpl and ConnectionBase(just for test) does not have an public construtor, so add the VertxImpl to resolve first, later will be removed
3、DefaultVertxMetrics does not have the vertx parameter, so add an setter method
4、delete the apache#961, jackson has fixed the promblem by FasterXML/jackson-core@b6c54cf
  • Loading branch information
jeho0815 committed Feb 1, 2019
1 parent ed82471 commit 23d0fda
Show file tree
Hide file tree
Showing 38 changed files with 2,838 additions and 377 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@

package org.apache.servicecomb.common.rest.codec;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.databind.ObjectMapper;

public abstract class AbstractRestObjectMapper extends ObjectMapper {
private static final long serialVersionUID = 189026839992490564L;

public AbstractRestObjectMapper(JsonFactory jsonFactory) {
super(jsonFactory);
}

abstract public String convertToString(Object value) throws Exception;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser.Feature;
import com.fasterxml.jackson.core.base.DoSFix;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonSerializer;
Expand All @@ -35,9 +34,6 @@
import io.vertx.core.json.JsonObject;

public class RestObjectMapper extends AbstractRestObjectMapper {
static {
DoSFix.init();
}

private static class JsonObjectSerializer extends JsonSerializer<JsonObject> {
@Override
Expand All @@ -52,7 +48,6 @@ public void serialize(JsonObject value, JsonGenerator jgen, SerializerProvider p

@SuppressWarnings("deprecation")
public RestObjectMapper() {
super(DoSFix.createJsonFactory());

// swagger中要求date使用ISO8601格式传递,这里与之做了功能绑定,这在cse中是没有问题的
setDateFormat(new com.fasterxml.jackson.databind.util.ISO8601DateFormat() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.UUID;

import javax.servlet.http.Part;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;

import org.hamcrest.Matchers;
Expand All @@ -35,7 +36,6 @@
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.CaseInsensitiveHeaders;
import io.vertx.core.http.HttpClientRequest;
import io.vertx.core.http.HttpHeaders;
import mockit.Deencapsulation;
import mockit.Expectations;
import mockit.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class TransportVertxFactory {
public TransportVertxFactory() {
vertxOptions.setMetricsOptions(metricsOptionsEx);
transportVertx = VertxUtils.getOrCreateVertxByName("transport", vertxOptions);
metricsFactory.setVertx(transportVertx, vertxOptions);
}

public DefaultVertxMetricsFactory getMetricsFactory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public void getTransportVertx() {

Assert.assertNotNull(vertxFactory.getTransportVertx());
Assert.assertSame(vertxFactory.getTransportVertx(), vertxFactory.getTransportVertx());
Assert.assertSame(vertxFactory.getTransportVertx(), vertxFactory.getMetricsFactory().getVertxMetrics().getVertx());

vertxFactory.getTransportVertx().close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ private void refreshMembers(MemberDiscovery memberDiscovery) {
String configCenter = memberDiscovery.getConfigServer();
IpPort ipPort = NetUtils.parseIpPortFromURI(configCenter);
clientMgr.findThreadBindClientPool().runOnContext(client -> {
@SuppressWarnings("deprecation")
HttpClientRequest request =
client.get(ipPort.getPort(), ipPort.getHostOrIp(), uriConst.MEMBERS, rsp -> {
if (rsp.statusCode() == HttpResponseStatus.OK.code()) {
Expand Down Expand Up @@ -374,6 +375,7 @@ public void refreshConfig(String configcenter, boolean wait) {
+ ParseConfigUtils.getInstance().getCurrentVersionInfo();
clientMgr.findThreadBindClientPool().runOnContext(client -> {
IpPort ipPort = NetUtils.parseIpPortFromURI(configcenter);
@SuppressWarnings("deprecation")
HttpClientRequest request = client.get(ipPort.getPort(), ipPort.getHostOrIp(), path, rsp -> {
if (rsp.statusCode() == HttpResponseStatus.OK.code()) {
rsp.bodyHandler(buf -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import mockit.MockUp;
import mockit.Mocked;

@SuppressWarnings("deprecation")
public class TestConfigCenterClient {
@BeforeClass
public static void setUpClass() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public static <T> void syncExecuteBlocking(Handler<Future<T>> blockingCodeHandle
}

@Override
public <T> void executeBlocking(Action<T> action, Handler<AsyncResult<T>> resultHandler) {
public <T> void executeBlockingInternal(Handler<Future<T>> action, Handler<AsyncResult<T>> resultHandler) {
syncExecuteBlocking((future) -> {
try {
future.complete(action.perform());
action.handle(future);
} catch (Throwable e) {
future.fail(e);
}
Expand All @@ -72,7 +72,7 @@ public <T> void executeBlocking(Handler<Future<T>> blockingCodeHandler, boolean
}

@Override
<T> void executeBlocking(Action<T> action, Handler<Future<T>> blockingCodeHandler,
<T> void executeBlocking(Handler<Future<T>> blockingCodeHandler,
Handler<AsyncResult<T>> resultHandler,
Executor exec, TaskQueue queue, @SuppressWarnings("rawtypes") PoolMetrics metrics) {
syncExecuteBlocking(blockingCodeHandler, resultHandler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.net.impl.transport.Transport;

/**
* after test finished, need to invoke vertx.close
Expand All @@ -28,10 +29,12 @@ public class SyncVertx extends VertxImpl {
private ContextImpl context = new SyncContext(this);

public SyncVertx() {
this(null, null);
this(new VertxOptions(), null);
}

protected SyncVertx(VertxOptions options, Handler<AsyncResult<Vertx>> resultHandler) {
super(options, Transport.transport(options.getPreferNativeTransport()));
init();
}

@Override
Expand Down
Loading

0 comments on commit 23d0fda

Please sign in to comment.