diff options
author | Denes Nemeth <denes.nemeth@nokia.com> | 2017-12-06 18:20:59 +0100 |
---|---|---|
committer | Denes Nemeth <denes.nemeth@nokia.com> | 2017-12-06 18:31:10 +0100 |
commit | b72d11d94a75cc849868189f16ddcf1745602099 (patch) | |
tree | 21f5158db9d20e68597de1e3811624f3d6af0a24 /src/main/java/org | |
parent | 9f483edc768522392ef40bbad5863e2ce79ee771 (diff) |
remove the heavy (many MB) unused dependencies
Change-Id: I023855c8b163004df8732b075dc08db06fbb9b9b
Issue-ID: MSB-102
Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com>
Diffstat (limited to 'src/main/java/org')
7 files changed, 5 insertions, 188 deletions
diff --git a/src/main/java/org/onap/msb/sdk/httpclient/ProxyRetrofitCall.java b/src/main/java/org/onap/msb/sdk/httpclient/ProxyRetrofitCall.java index ac831e9..0e5968d 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/ProxyRetrofitCall.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/ProxyRetrofitCall.java @@ -17,7 +17,6 @@ import java.io.IOException; import java.lang.reflect.Method; import org.onap.msb.sdk.httpclient.handler.RetrofitServiceHandler; -import org.onap.msb.sdk.httpclient.metric.MetricObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,13 +41,8 @@ public class ProxyRetrofitCall<T extends Object> implements Call<T> { private Object[] args; - private MetricObject metricObject; - - - public ProxyRetrofitCall(Call targetCall, RetrofitServiceHandler retrofitServiceHandler, - ServiceHttpEndPointObject endPoint, Object proxy, Method method, Object[] args, - MetricObject metricObject) { + ServiceHttpEndPointObject endPoint, Object proxy, Method method, Object[] args) { super(); this.targetCall = targetCall; this.handler = retrofitServiceHandler; @@ -56,7 +50,6 @@ public class ProxyRetrofitCall<T extends Object> implements Call<T> { this.proxy = proxy; this.method = method; this.args = args; - this.metricObject = metricObject; } @Override @@ -116,7 +109,7 @@ public class ProxyRetrofitCall<T extends Object> implements Call<T> { public Call<T> clone() { // TODO Auto-generated method stub return new ProxyRetrofitCall(targetCall.clone(), this.handler, this.endPoint, this.proxy, - this.method, this.args, metricObject); + this.method, this.args); } @Override diff --git a/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandler.java b/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandler.java index 7b886d6..74096e7 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandler.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandler.java @@ -87,8 +87,7 @@ public class RetrofitServiceHandler implements InvocationHandler { if (resultObjecct instanceof Call) { Call targetCall = (Call) resultObjecct; - return new ProxyRetrofitCall(targetCall, this, wapper.endPoint, proxy, method, args, - flowContext.getMetricmanager().getMetricObject(method)); + return new ProxyRetrofitCall(targetCall, this, wapper.endPoint, proxy, method, args); } return resultObjecct; } diff --git a/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerContext.java b/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerContext.java index 713d0f6..8825403 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerContext.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerContext.java @@ -22,7 +22,6 @@ import org.onap.msb.sdk.httpclient.builder.IRetrofitObjectBuilder; import org.onap.msb.sdk.httpclient.conf.HttpClientConf; import org.onap.msb.sdk.httpclient.convert.IConverterFactoryBuilder; import org.onap.msb.sdk.httpclient.lb.ILoadBalanceStrategy; -import org.onap.msb.sdk.httpclient.metric.MetricManager; import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; @@ -55,8 +54,6 @@ public class RetrofitServiceHandlerContext { private ILoadBalanceStrategy lbStrategy; - private MetricManager metricmanager; - private IRetrofitObjectBuilder retrofitObjectBuilder; private ServiceHttpEndPointBeanObject serviceHttpEndPointBeanObject = null; @@ -113,14 +110,6 @@ public class RetrofitServiceHandlerContext { } - public MetricManager getMetricmanager() { - return metricmanager; - } - - public void setMetricmanager(MetricManager metricmanager) { - this.metricmanager = metricmanager; - } - public IRetrofitObjectBuilder getRetrofitObjectBuilder() { return retrofitObjectBuilder; } diff --git a/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerFactory.java b/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerFactory.java index 1d65661..5b4bfda 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerFactory.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerFactory.java @@ -18,6 +18,7 @@ package org.onap.msb.sdk.httpclient.handler; import java.lang.reflect.InvocationHandler; import java.util.List; +import java.util.ArrayList; import org.onap.msb.sdk.httpclient.ServiceHttpEndPointBeanObject; import org.onap.msb.sdk.httpclient.conf.HttpClientConf; @@ -25,13 +26,10 @@ import org.onap.msb.sdk.httpclient.exception.RetrofitServiceRuntimeException; import org.onap.msb.sdk.httpclient.handler.impl.ConnectionParamsBuilder; import org.onap.msb.sdk.httpclient.handler.impl.ConverterFactoryBuilder; import org.onap.msb.sdk.httpclient.handler.impl.LBBuilder; -import org.onap.msb.sdk.httpclient.handler.impl.MetricmanagerBuilder; import org.onap.msb.sdk.httpclient.handler.impl.RetrofitHandlerContextBuilder; import org.onap.msb.sdk.httpclient.handler.impl.ServiceHttpEndPointBeanObjectBuilder; import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; -import com.google.common.collect.Lists; - /** * @author 10071214 * @@ -39,12 +37,11 @@ import com.google.common.collect.Lists; public class RetrofitServiceHandlerFactory { - private List<HandlerContextBuilder> builders = Lists.newArrayList(); + private List<HandlerContextBuilder> builders = new ArrayList<>(); public void init() { builders.add(new ServiceHttpEndPointBeanObjectBuilder()); - builders.add(new MetricmanagerBuilder()); builders.add(new LBBuilder()); builders.add(new ConnectionParamsBuilder()); builders.add(new ConverterFactoryBuilder()); diff --git a/src/main/java/org/onap/msb/sdk/httpclient/handler/impl/MetricmanagerBuilder.java b/src/main/java/org/onap/msb/sdk/httpclient/handler/impl/MetricmanagerBuilder.java deleted file mode 100644 index 3dbe4e2..0000000 --- a/src/main/java/org/onap/msb/sdk/httpclient/handler/impl/MetricmanagerBuilder.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright 2017 ZTE, Inc. and others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - ******************************************************************************/ -/** - * - */ -package org.onap.msb.sdk.httpclient.handler.impl; - -import org.onap.msb.sdk.httpclient.exception.RetrofitServiceRuntimeException; -import org.onap.msb.sdk.httpclient.handler.HandlerContextBuilder; -import org.onap.msb.sdk.httpclient.handler.RetrofitServiceHandlerContext; -import org.onap.msb.sdk.httpclient.metric.MetricManager; - -/** - * @author 10071214 - * - */ -public class MetricmanagerBuilder implements HandlerContextBuilder { - - @Override - public void build(RetrofitServiceHandlerContext ctx) throws RetrofitServiceRuntimeException { - MetricManager metricmanager = new MetricManager(); - ctx.setMetricmanager(metricmanager); - metricmanager.initMetric(ctx.getRetrofitSrvInterfaceClazz()); - - } - - -} diff --git a/src/main/java/org/onap/msb/sdk/httpclient/metric/MetricManager.java b/src/main/java/org/onap/msb/sdk/httpclient/metric/MetricManager.java deleted file mode 100644 index ee81723..0000000 --- a/src/main/java/org/onap/msb/sdk/httpclient/metric/MetricManager.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright 2017 ZTE, Inc. and others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - ******************************************************************************/ -package org.onap.msb.sdk.httpclient.metric; - -import static com.codahale.metrics.MetricRegistry.name; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import com.codahale.metrics.JmxReporter; -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.Slf4jReporter; -import com.codahale.metrics.Timer; - -/** - * @author hu.rui - * - */ -public class MetricManager { - - private static MetricRegistry registry = new MetricRegistry(); - - private static Slf4jReporter slf4jReporter; - - private static JmxReporter jmxReporter; - - static { - initMetricReporters(); - } - - protected Map<Method, Timer> timers = new HashMap<>(); - protected Map<Method, Meter> meters = new HashMap<>(); - protected Map<Method, Meter> exceptionmeters = new HashMap<>(); - - - - private static void initMetricReporters() { - - /* - * slf4jReporter = Slf4jReporter.forRegistry(registry) - * .outputTo(LoggerFactory.getLogger(RetrofitServiceHandler.class)) - * .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); - * slf4jReporter.start(10, TimeUnit.MINUTES); - */ - - jmxReporter = JmxReporter.forRegistry(registry).build(); - jmxReporter.start(); - - } - - public void initMetric(Class retrofitSrvInterfaceClazz) { - - for (Method method : retrofitSrvInterfaceClazz.getMethods()) { - - timers.put(method, registry.timer(chooseName(method, "timer"))); - meters.put(method, registry.meter(chooseName(method, "meter"))); - exceptionmeters.put(method, registry.meter(chooseName(method, "exception"))); - } - - - } - - private String chooseName(final Method method, final String... suffixes) { - return name(name(method.getDeclaringClass(), method.getName()), suffixes); - } - - public MetricObject getMetricObject(Method method) { - return new MetricObject(timers.get(method), meters.get(method), exceptionmeters.get(method)); - } - -} diff --git a/src/main/java/org/onap/msb/sdk/httpclient/metric/MetricObject.java b/src/main/java/org/onap/msb/sdk/httpclient/metric/MetricObject.java deleted file mode 100644 index 7cc1473..0000000 --- a/src/main/java/org/onap/msb/sdk/httpclient/metric/MetricObject.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright 2017 ZTE, Inc. and others. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - ******************************************************************************/ -package org.onap.msb.sdk.httpclient.metric; - -import com.codahale.metrics.Meter; -import com.codahale.metrics.Timer; - -/** - * @author hu.rui - * - */ -public class MetricObject { - - public Timer timer; - public Meter meter; - public Meter exceptionmeter; - - public MetricObject(Timer timer, Meter meter, Meter exceptionmeter) { - super(); - this.timer = timer; - this.meter = meter; - this.exceptionmeter = exceptionmeter; - } - - - -} |