mirror of
https://github.com/valitydev/woody_java.git
synced 2024-11-06 08:15:21 +00:00
Ft/bj 180/network timeout (#22)
* BJ-180: Added client network timeout config * BJ-180: Log style formatting, add more info * BJ-180: Disable pooling test * BJ-180: Fixed bug: no logs if withEventListener hasn't been invoked * BJ-180: Bumped build image tag
This commit is contained in:
parent
0ffe62178c
commit
c7ca08f8a7
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -8,6 +8,6 @@ build('woody_java', 'docker-host') {
|
||||
javaLibPipeline = load("build_utils/jenkins_lib/pipeJavaLib.groovy")
|
||||
}
|
||||
|
||||
def buildImageTag = "7372dc01bf066b5b26be13d6de0c7bed70648a26"
|
||||
def buildImageTag = "4799280a02cb73761a3ba3641285aac8ec4ec482"
|
||||
javaLibPipeline(buildImageTag)
|
||||
}
|
2
pom.xml
2
pom.xml
@ -12,7 +12,7 @@
|
||||
<packaging>pom</packaging>
|
||||
<groupId>com.rbkmoney.woody</groupId>
|
||||
<artifactId>woody</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>1.1.3</version>
|
||||
|
||||
<description>Java implementation for Woody spec</description>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>woody</artifactId>
|
||||
<groupId>com.rbkmoney.woody</groupId>
|
||||
<version>1.1.2</version>
|
||||
<version>1.1.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -14,6 +14,7 @@ import com.rbkmoney.woody.api.trace.ContextSpan;
|
||||
import com.rbkmoney.woody.api.trace.context.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
@ -27,6 +28,7 @@ public abstract class AbstractClientBuilder implements ClientBuilder {
|
||||
private IdGenerator idGenerator;
|
||||
private ClientEventListener eventListener = DEFAULT_EVENT_LISTENER;
|
||||
private boolean allowObjectProxyOverriding = false;
|
||||
private final AtomicBoolean used = new AtomicBoolean(false);
|
||||
|
||||
@Override
|
||||
public ClientBuilder withAddress(URI address) {
|
||||
@ -63,6 +65,9 @@ public abstract class AbstractClientBuilder implements ClientBuilder {
|
||||
|
||||
@Override
|
||||
public <T> T build(Class<T> iface) {
|
||||
if (!used.compareAndSet(false, true)) {
|
||||
throw new IllegalStateException("Builder already used");
|
||||
}
|
||||
try {
|
||||
T target = createProviderClient(iface);
|
||||
return build(iface, new SingleTargetProvider<>(iface, target));
|
||||
|
@ -9,6 +9,8 @@ import com.rbkmoney.woody.api.proxy.tracer.EventTracer;
|
||||
import com.rbkmoney.woody.api.proxy.tracer.MethodCallTracer;
|
||||
import com.rbkmoney.woody.api.proxy.tracer.TargetCallTracer;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* Created by vpankrashkin on 10.05.16.
|
||||
*/
|
||||
@ -18,6 +20,7 @@ public abstract class AbstractServiceBuilder<Srv> implements ServiceBuilder<Srv>
|
||||
private boolean allowObjectProxyOverriding = false;
|
||||
|
||||
private ServiceEventListener eventListener = DEFAULT_EVENT_LISTENER;
|
||||
private final AtomicBoolean used = new AtomicBoolean(false);
|
||||
|
||||
@Override
|
||||
public ServiceBuilder withEventListener(ServiceEventListener listener) {
|
||||
@ -27,6 +30,9 @@ public abstract class AbstractServiceBuilder<Srv> implements ServiceBuilder<Srv>
|
||||
|
||||
@Override
|
||||
public <T> Srv build(Class<T> iface, T serviceHandler) {
|
||||
if (!used.compareAndSet(false, true)) {
|
||||
throw new IllegalStateException("Builder already used");
|
||||
}
|
||||
try {
|
||||
T target = createProxyService(iface, serviceHandler);
|
||||
return createProviderService(iface, target);
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>woody</artifactId>
|
||||
<groupId>com.rbkmoney.woody</groupId>
|
||||
<version>1.1.2</version>
|
||||
<version>1.1.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney.thrift</groupId>
|
||||
<artifactId>libthrift</artifactId>
|
||||
<version>0.9.3-5</version>
|
||||
<version>0.9.3-6</version>
|
||||
</dependency>
|
||||
<!--Thirdparty libs-->
|
||||
<dependency>
|
||||
|
@ -3,6 +3,7 @@ package com.rbkmoney.woody.thrift.impl.http;
|
||||
import com.rbkmoney.woody.api.AbstractClientBuilder;
|
||||
import com.rbkmoney.woody.api.event.ClientEventListener;
|
||||
import com.rbkmoney.woody.api.event.CompositeClientEventListener;
|
||||
import com.rbkmoney.woody.api.event.EventListener;
|
||||
import com.rbkmoney.woody.api.flow.WFlow;
|
||||
import com.rbkmoney.woody.api.flow.error.ErrorMapProcessor;
|
||||
import com.rbkmoney.woody.api.flow.error.WErrorDefinition;
|
||||
@ -96,9 +97,6 @@ public class THClientBuilder extends AbstractClientBuilder {
|
||||
|
||||
@Override
|
||||
public THClientBuilder withEventListener(ClientEventListener listener) {
|
||||
if (logEnabled) {
|
||||
listener = new CompositeClientEventListener(logListener, listener);
|
||||
}
|
||||
return (THClientBuilder) super.withEventListener(listener);
|
||||
}
|
||||
|
||||
@ -120,6 +118,17 @@ public class THClientBuilder extends AbstractClientBuilder {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> T build(Class<T> iface) {
|
||||
if (logEnabled) {
|
||||
ClientEventListener listener = getEventListener();
|
||||
listener = listener == null ? logListener : new CompositeClientEventListener(logListener, listener);
|
||||
withEventListener(listener);
|
||||
}
|
||||
return super.build(iface);
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,16 @@ public class THServiceBuilder extends AbstractServiceBuilder<Servlet> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Servlet build(Class<T> iface, T serviceHandler) {
|
||||
if (logEnabled) {
|
||||
ServiceEventListener listener = getEventListener();
|
||||
listener = listener == null ? logListener : new CompositeServiceEventListener(logListener, listener);
|
||||
withEventListener(listener);
|
||||
}
|
||||
return super.build(iface, serviceHandler);
|
||||
}
|
||||
|
||||
protected BiConsumer<WErrorDefinition, ContextSpan> getErrorDefinitionConsumer() {
|
||||
return (eDef, contextSpan) -> {
|
||||
if (eDef.getErrorType() != WErrorType.BUSINESS_ERROR)
|
||||
|
@ -20,7 +20,7 @@ public class THCEventLogListener implements ClientEventListener<THClientEvent> {
|
||||
try {
|
||||
switch (event.getEventType()) {
|
||||
case CALL_SERVICE:
|
||||
log.info("CLN: {}, [{}, Type: {}]", event.getEventType(), event.getCallName(), event.getCallType());
|
||||
log.info("CLN: {}, [{}, {}]", event.getEventType(), event.getCallName(), event.getCallType());
|
||||
break;
|
||||
case CLIENT_SEND:
|
||||
HttpRequestBase request = event.getTransportRequest();
|
||||
|
@ -22,7 +22,7 @@ public class THSEventLogListener implements ServiceEventListener<THServiceEvent>
|
||||
try {
|
||||
switch (event.getEventType()) {
|
||||
case CALL_HANDLER:
|
||||
log.info("SRV: {}, [{}, Type: {}]", event.getEventType(), event.getCallName(), event.getCallType());
|
||||
log.info("SRV: {}, [{}, {}]", event.getEventType(), event.getCallName(), event.getCallType());
|
||||
break;
|
||||
case HANDLER_RESULT:
|
||||
log.info("SRV: {}, CStatus: {}, HTime: {}ms", event.getEventType(), event.isSuccessfulCall() ? "ok" : "error", (System.currentTimeMillis() - event.getTimeStamp()));
|
||||
|
Loading…
Reference in New Issue
Block a user